当前第2页 返回上一页
如配置在http内,启动nginx会报如下错误:
1 | nginx: [emerg] "server" directive is not allowed here
|
3.在tcp.d下新建个bss_num_30001.conf文件,内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | stream {
# 添加socket转发的代理
upstream bss_num_socket {
hash $remote_addr consistent;
# 转发的目的地址和端口
server 130.51.11.33:19001 weight=5 max_fails=3 fail_timeout=30s;
}
# 提供转发的服务,即访问localhost:30001,会跳转至代理bss_num_socket指定的转发地址
server {
listen 30001;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass bss_num_socket;
}
}
|
4.重启nginx,访问localhost:30001,会跳转到bss_num_socket指定的转发地址130.51.11.33:19001。
更多Nginx相关技术文章,请访问Nginx使用教程栏目进行学习!
以上就是nginx支持socket吗的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
linux如何查看nginx是否启动
提高nginx安全性方法
教你如何在linux中安装nginx服务器
nginx开源吗
nginx怎么下载
深入 nginx 之配置篇
如何修改nginx的运行端口
用了dubbo还有必要用nginx吗
centos下nginx无法访问怎么办
nginx 怎么读
更多相关阅读请进入《nginx》频道 >>
转载请注明出处:木庄网络博客 » nginx支持socket吗