这就是我的 example.com.conf 文件的样子 -
upstream web_app_backend {
ip_hash;
server <app1 ip>:<port>;
server <app2 ip>:<port>;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/nginx/ssl/example.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;
return 302 http://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://web_app_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
可能出了什么问题?当我加载https://example.com,我在 access.log 文件和 error.log 文件中看不到任何日志。
答案1
事实证明我的443
端口被堵塞了。