最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

nginx stream無(wú)法使用的解決辦法

 更新時(shí)間:2024年02月02日 11:54:12   作者:用代碼記錄生活  
nginx的stream模塊一般用于tcp/UDP數(shù)據(jù)流的代理和負(fù)載均衡,本文將給大家介紹一下如何解決nginx stream無(wú)法使用問(wèn)題,文中通過(guò)代碼示例給大家介紹的非常詳細(xì),需要的朋友可以參考下

錯(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)文章

最新評(píng)論

滨海县| 额济纳旗| 三台县| 治县。| 墨江| 景洪市| 枞阳县| 衡水市| 绵阳市| 离岛区| 福清市| 高要市| 八宿县| 娄烦县| 任丘市| 青川县| 武冈市| 广西| 巴林右旗| 安阳县| 卢氏县| 衡南县| 湖南省| 巴南区| 陇川县| 漳浦县| 东阳市| 牙克石市| 泽州县| 贵德县| 西安市| 遂宁市| 牡丹江市| 五大连池市| 黑河市| 中宁县| 青阳县| 古浪县| 萍乡市| 泾阳县| 彰武县|