昨天我的 apache 伺服器決定不再運行,但我現在不知道為什麼。每個虛擬主機都會顯示 403 錯誤訊息,類似於我從日誌檔案複製的以下內容:
[error] [client 127.0.0.1] (13)Permission denied: access to / denied
我認為權限設定正確,我用 ls -al /home/... 證明了,實際上我沒有更改配置中的任何內容:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName webprojekte
DocumentRoot /home/tarea/Webprojekte/work
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tarea/Webprojekte/work/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
順便說一下 phpmyadmin 仍然可以正常工作。謝謝你幫我!
答案1
這不是配置,而是檔案權限本身。您需要將chmod
Web 根目錄設定為 755,將 Web 檔案設定為 664。
更好的解決方案是使用 apache 中的使用者模組,它允許使用者將檔案託管在主目錄中的 public_html 資料夾中。
欲了解更多信息,請參閱: