我有两个Nginx配置,如下所示:
#Nginx.conf
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
include /etc/nginx/sites-enabled/*;
}
stream {
server {
listen 192.168.2.152:80;
listen 192.168.2.152:443;
proxy_pass tcp_socket;
}
upstream tcp_socket {
server 127.0.0.1:6000;
}
}
另一个配置为默认的nginx配置
server {
# for production
listen 192.168.2.152:80;
location /test {
proxy_pass http://127.0.0.1:6000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
keepalive_requests 1000;
keepalive_timeout 75;
}
当/etc/nginx/sites-enabled/default
不存在时,第一个配置正在工作。
但是,当我删除/etc/nginx/nginx.conf中存在的配置并使用/etc/nginx/sites-enabled/default
进行测试时,它将不起作用。
我们正在通过代理传递进行Web套接字连接