Internal Server Error


Internal Server Error

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

wordpress 從倉庫中拉下來時,報了上述錯誤,嘗試各種辦法也找不到具體解決辦法。

背景介紹

由於本地需要搭建一套 wordpress 環境,鑒於自己不太會服務器這塊,只好利用PHP環境一鍵達成的軟件 phpStudy,並從倉庫中落下代碼,啟動。首頁進入,完全沒問題,但是在通過菜單進入時,就各種問題。
使用apache和nginx代理時,報的錯誤還不同。

解決之路

目前網上主要偏向於, apache 配置問題

  • apache 配置修改
    1. Find and open the file .http.conf. This will be located in your Apache install folder.
    2. Make a backup of http.conf which you can restore from, if anything were to go wrong
    3. Find the line #LoadModule rewrite_module modules/mod_rewrite.so and remove the hash ‘#’
    4. Locate the block within the directory tags as indicated below and change to:
    ```
      <directory />
        Options All
        AllowOverride All
      </directory>
    ```
    
    1. Find any additional occurrences of the line “AllowOverride None” and change it to “AllowOverride All”.
      6.Finally, restart apache server and your browser. The .htaccess rewriting should now be working for any local website.

但是在嘗試時,依舊沒解決,最后在 .htaccess 這個地方思考良久,才發現自己的配置除了問題

.htaccess

  • .htaccess

    在 wordpress 目錄下,居然有該文件,內容如下

      # BEGIN WordPress
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>
    
      # END WordPress
    

    發現 RewriteBaseRewriteRule 路勁有問題,修改為當前目錄下,便解決了

總結

由於自己的電腦有多種終端,而當一個問題出現時,在不同的終端下,報的錯誤還不相同,因而被迫去理解錯誤的具體含義,具體原因是什么。目前開發到后期,才發現很多錯誤需要自己去看其他功底,比如文件讀取權限,linux命令行,等等。趁着這段時間,不斷鞭笞自己吧。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM