我通过阅读 Stackoverflow 和其他论坛上的不同答案进行了很多尝试,但无法识别错误,有人可以检查下面的配置并告诉我可能出了什么问题吗?
server {
server_name test.domain.com;
listen 80;
location / {
proxy_pass http://176.X.XX.XXX:30805;
}
}
server {
server_name test.domain.com;
listen 443 ssl;
access_log /var/log/nginx/ssl_access_test main;
error_log /var/log/nginx/ssl_error_test info;
ssl_certificate /root/ssl/wildcard.domain.com.pem;
ssl_certificate_key /root/ssl/wildcard.domain.com.pem;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
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_redirect http:// https://;
proxy_pass http://176.X.XX.XXX:30805;
}
}
我能够访问该页面http://test.domain.com但无法安装https://test.domain.com(而不是连接超时),我还尝试从端口 80 重定向到 443,但没有帮助。因为我尝试了很多不同的配置组合
对于上述配置,输出为nginx -t
:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
答案1
配置不错。安装firewall-cmd
并添加端口 443 规则后问题已解决