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

nginx stream無法使用的解決辦法

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

錯誤代碼

[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;
	}
}
  • 保存配置文件, 并測試配置文件
[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
  • 此時發(fā)現(xiàn)測試配置文件通過, 可以成功啟動nginx

到此這篇關(guān)于nginx stream無法使用的解決辦法的文章就介紹到這了,更多相關(guān)nginx stream無法使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

潞西市| 双城市| 延吉市| 台东县| 宁陵县| 徐闻县| 澄迈县| 清新县| 万州区| 德阳市| 民权县| 云霄县| 罗山县| 进贤县| 神池县| 巴楚县| 宁远县| 丹江口市| 德江县| 红安县| 进贤县| 巴林右旗| 怀仁县| 云南省| 中方县| 天长市| 德令哈市| 洪江市| 长岭县| 眉山市| 永德县| 玉环县| 都匀市| 阿尔山市| 九龙城区| 泰安市| 海原县| 含山县| 会理县| 宝坻区| 宁波市|