我正在尝试在 ubuntu 上部署 nginx/gunicorn/flask,当我导航到“domain.com”时,一切似乎都在工作,但是当我转到“www.domain.com”时,我得到了 nginx 的默认启动画面。
nginx的设置如下。
server {
server_name thecomputermade.me www.thecomputermade.me;
location / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/imageRate/imageRate.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/thecomputermade.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/thecomputermade.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = thecomputermade.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name thecomputermade.me;
return 404; # managed by Certbot
}
当我跑步时,systemctl status nginx
我得到以下信息。
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-11-16 08:54:05 UTC; 999ms ago
Docs: man:nginx(8)
Process: 1430 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1442 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1443 (nginx)
Tasks: 2 (limit: 560)
Memory: 2.9M
CGroup: /system.slice/nginx.service
├─1443 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─1444 nginx: worker process
Nov 16 08:54:05 ip-172-26-6-186 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 16 08:54:05 ip-172-26-6-186 nginx[1430]: nginx: [warn] conflicting server name "www.thecomputermade.me" on 0.0.0.0:443, ignored
Nov 16 08:54:05 ip-172-26-6-186 nginx[1442]: nginx: [warn] conflicting server name "www.thecomputermade.me" on 0.0.0.0:443, ignored
Nov 16 08:54:05 ip-172-26-6-186 systemd[1]: Started A high performance web server and a reverse proxy server.
请注意它显示冲突服务器名称的行...
我已经在 nginx 配置中尝试了 computermade.me:
- “thecomputermade.me”按预期工作,但“www.thecomputermade.me”再次导航到 nginx 的默认启动屏幕。
当我在配置中仅添加“www.thecomputermade.me”时:
- 两个地址都导航默认启动画面,我收到冲突的服务器名称警告。
有谁知道我需要做什么?