Centos

HTTPS 請求連接超時 (NGINX)

  • March 12, 2018

我通過閱讀 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

配置很好。firewall-cmd為埠 443 安裝和添加規則後問題已解決

引用自:https://unix.stackexchange.com/questions/429266