Nginx ssl設定後自動下載根目錄的index.php而不是載入

來源:互聯網
上載者:User
碰到了一個奇怪的小白問題,通過如下配置在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緩衝這麼久都不失效。。。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.