nginx stream無(wú)法使用的解決辦法
錯(cuò)誤代碼
[root@xxx nginx]# ./sbin/nginx -t nginx: [emerg] unknown directive "stream" in /usr/local/nginx//conf/nginx.conf:118 nginx: configuration file /usr/local/nginx//conf/nginx.conf test failed #或者這種 [root@xxx nginx]# ./sbin/nginx -t nginx: [emerg] dlopen() "/usr/lib64/nginx/modules/ngx_stream_module.so" failed (/usr/lib64/nginx/modules/ngx_stream_module.so: undefined symbol: ngx_ssl_session_cache_init) in /usr/local/nginx/conf/nginx.conf:2 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
解決辦法
- 先刪除原有的nginx
- 重新構(gòu)建nginx
# 添加使用--with-stream=dynamic 配置 ./configure --prefix=/usr/local/nginx/ --with-stream=dynamic # 然后make make install make make install
- 到/usr/local/nginx/ 中發(fā)現(xiàn)多了modules文件夾
[root@fhd nginx]# ll total 0 drwxr-xr-x 2 root root 333 Mar 9 11:10 conf drwxr-xr-x 2 root root 40 Mar 9 11:09 html drwxr-xr-x 2 root root 6 Mar 9 11:09 logs drwxr-xr-x 2 root root 34 Mar 9 11:09 modules drwxr-xr-x 2 root root 19 Mar 9 11:09 sbin
- 修改nginx.conf文件, 在首行添加 load_module /usr/local/nginx/modules/ngx_stream_module.so;
load_module /usr/local/nginx/modules/ngx_stream_module.so;
- 再次使用stream
stream { upstream kube-apiserver { server 192.168.10.64:6443 max_fails=3 fail_timeout=30s; server 192.168.10.65:6443 max_fails=3 fail_timeout=30s; } server { listen 7443; proxy_connect_timeout 2s; proxy_timeout 900s; proxy_pass kube-apiserver; } }
- 保存配置文件, 并測(cè)試配置文件
[root@fhd nginx]# ./sbin/nginx -t nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
- 此時(shí)發(fā)現(xiàn)測(cè)試配置文件通過(guò), 可以成功啟動(dòng)nginx
到此這篇關(guān)于nginx stream無(wú)法使用的解決辦法的文章就介紹到這了,更多相關(guān)nginx stream無(wú)法使用內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
nginx lua集成kafka的實(shí)現(xiàn)方法
這篇文章主要介紹了nginx lua集成kafka的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08Nginx worker_connections配置太低導(dǎo)致500錯(cuò)誤案例
這篇文章主要介紹了Nginx worker_connections配置太低導(dǎo)致500錯(cuò)誤案例,需要的朋友可以參考下2015-04-04Nginx 實(shí)現(xiàn)灰度發(fā)布的三種方法總結(jié)
這篇文章主要介紹了Nginx 實(shí)現(xiàn)灰度發(fā)布的三種方法總結(jié)的相關(guān)資料,需要的朋友可以參考下2017-05-05借用nginx.vim工具進(jìn)行語(yǔ)法高亮和格式化配置nginx.conf文件
今天小編就為大家分享一篇關(guān)于借用nginx.vim工具進(jìn)行語(yǔ)法高亮和格式化配置nginx.conf文件,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-02-02nginx 如何實(shí)現(xiàn)if嵌套的方法示例
這篇文章主要介紹了nginx 如何實(shí)現(xiàn)if嵌套的方法示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11nginx中$host、$http_host和$proxy_host區(qū)別小結(jié)
本文主要介紹了nginx中$host、$http_host和$proxy_host區(qū)別小結(jié),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2024-09-09