【发布时间】:2017-03-12 15:18:58
【问题描述】:
如果我调用 www..com,我正在使用 nginx,我的浏览器找不到任何内容,并且没有显示页面 https://.com 和 .com 工作正常。
这是我的 conf 文件,尝试了一些不同的配置,但它们无助于解决我的问题
# HTTP — redirect all traffic to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
# HTTPS — proxy all requests to the Node app
server {
# Enable HTTP/2
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name <MY-DOMAIN>;
# Use the Let’s Encrypt certificates
ssl on;
ssl_certificate /etc/letsencrypt/live/<MY-DOMAIN>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<MY-DOMAIN>/privkey.pem;
# Include the SSL configuration from cipherli.st
include /etc/nginx/conf.d/ssl-params.conf;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
更新-1
错误日志
2017/03/12 16:40:17 [warn] 23185#23185: *59 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/1/00/0000000001 while reading upstream, client: 91.22.34.177, server: <MY-DOMAIN>, request: "GET /bundle.js HTTP/1.1", upstream: "http://127.0.0.1:8080/bundle.js", host: "<MY-DOMAIN>", referrer: "https://<MY-DOMAIN>/"
【问题讨论】: