[英]Nginx not working on port 80
我有一個在localhost:1337
上運行的node.js服務器。 我已經在sites_enabled
制作了一個nginx站點文件。 如果我訪問url admin.tvchatter.cn:1337
,它可以工作,但是如果我訪問url admin.tvchatter.cn
,則頁面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";
}
}
您需要指定root
子句,默認情況下它包含值: /var/www/html/index.html
因此您會看到默認的nginx頁面。 我的配置看起來像:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
檢查/etc/nginx/sites-enabled/
所有文件以找到:
proxy_pass http://example.com:8080;
查看nginx使用proxy_pass到其他端口。
如果是,請禁用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.