【发布时间】:2016-05-11 04:01:21
【问题描述】:
我有一个在 localhost:1337 上运行的 node.js 服务器。我在sites_enabled 中创建了一个 nginx 站点文件。如果我转到 url admin.tvchatter.cn:1337,它正在工作,但如果我转到 url admin.tvchatter.cn,页面将显示“欢迎使用 nginx!”。 listen 80 似乎不起作用。文件内容是:
server {
listen 80;
server_name admin.tvchatter.cn;
access_log /var/log/nginx/admin.tvchatter.cn.access.log;
error_log /var/log/nginx/admin.tvchatter.cn.error.log;
client_max_body_size 200m;
gzip on;
gzip_min_length 1k;
gzip_buffers 16 64k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
location /{
proxy_pass http://127.0.0.1:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
【问题讨论】:
-
"Welcome to nginx!"意思是,nginx 正在使用端口 80,但它没有将流量从端口 80 重定向到端口 1337
标签: http nginx configuration