当前第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吗的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
nginx文件在哪里
nginx是web容器么
nginx如何正确配置https
详解nginx配置文件nginx.conf
linux怎么启动nginx?
centos使用yum安装nginx提示找不到包怎么办
多个nginx集群怎么工作
nginx负载均衡参数有哪些
如何开启或禁用nginx缓存
位运算与nginx性能的联系
更多相关阅读请进入《nginx》频道 >>
转载请注明出处:木庄网络博客 » nginx支持socket吗