碰到了一個奇怪的小白問題,通過如下配置在nginx上配置ssl後,用https訪問首頁的話,瀏覽器直接下載index.php,而不是載入index.php,nginx啟動無報錯還請各位高手指教,多謝。
server { root /var/www/html; index index.html index.htm index.php; listen 443; server_name localhost; ssl on; ssl_certificate a.crt; ssl_certificate_key a.key; ssl_session_timeout 10m; ssl_session_cache shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP; ssl_prefer_server_ciphers on; }
回複內容:
碰到了一個奇怪的小白問題,通過如下配置在nginx上配置ssl後,用https訪問首頁的話,瀏覽器直接下載index.php,而不是載入index.php,nginx啟動無報錯還請各位高手指教,多謝。
server { root /var/www/html; index index.html index.htm index.php; listen 443; server_name localhost; ssl on; ssl_certificate a.crt; ssl_certificate_key a.key; ssl_session_timeout 10m; ssl_session_cache shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP; ssl_prefer_server_ciphers on; }
和 SSL 沒有關係,請確認:
- 這個請求的確匹配到了這個 server 而不是別的
- 這個 server 的配置的其他部分指明了如何處理 .php 檔案(發往 php-fpm)
繼續頂。。。
你的程式遇到https://xxx.com/111.html是可以的訪問的(不考慮偽靜態)
但訪問.php尾碼卻無法正確執行
說明你的nginx與php沒有關聯
我對你們在網上回答的答案感到很疑惑,你們確定遇到這個問題嗎?
我把VPS關閉了快4個小時,然後開網站一樣會下載index.php。更別說是因為SSL還是https還是php還是nginx了,我恢複以前的正常快照一樣會碰到這個問題。
ipconfig /flushdns 重啟電腦、手機3G訪問,一樣會下載這玩意,我就納悶了,CDN緩衝這麼久都不失效。。。