
我瀏覽了很多帖子,但沒有一個能解決我的問題,所以我才來問。
我從未設定過網域或子網域,因此任何簡單的錯誤都可能成為問題。
系統:
- Debian 6.0.6
- 阿帕契2.2.16
到目前為止我所做的:
- 建立了 A 記錄。 (看起來解決得很好)
新增了一個網站可用設定文件,如下所示:
<VirtualHost *:80> ServerAdmin [email protected] ServerName m.mores.es DocumentRoot /var/www/internet/movil/ <Directory /> Options Indexes FollowSymLinks Includes ExecCGI DirectoryIndex index.php index.html AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/m.mores.es-error.log CustomLog /var/log/apache2/m.mores.es-access.log combined </VirtualHost>
我已經運行命令 a2ensite m.mores.es (在可用網站中建立的文件的名稱)
重新啟動阿帕契
在這裡,我得到了禁止的錯誤。
- 將資料夾權限遞歸更改為 775
- 重新啟動阿帕契
我收到禁止的錯誤。
有什麼線索嗎?
編輯 apache 日誌:這可能是關鍵。當我在檔案上設定另一個日誌檔案時,此日誌出現在「other_vhosts_access.log」上。 m.mores.es 的存取文件和錯誤文件均存在,但為空。這是唯一與 m.mores.es 相關的日誌
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:54 +0200] "GET /index.html HTTP/1.1" 403 237 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:54 +0200] "GET /index.html HTTP/1.1" 403 237 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:55 +0200] "GET /favicon.ico HTTP/1.1" 302 241 "http://m.mores.es/index.html" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:02:55 +0200] "GET /favicon.ico HTTP/1.1" 302 241 "http://m.mores.es/index.html" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:03:01 +0200] "GET /index.php HTTP/1.1" 302 241 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
m.mores.es:80 212.89.22.73 - - [15/Jun/2015:17:03:01 +0200] "GET /index.php HTTP/1.1" 302 241 "-" "Mozilla/5.0 (Windows NT 5.1)
答案1
您已將 DocumentRoot 設定為,/var/www/internet/movil/
但將目錄指向/
。改成這樣說
<Directory /var/www/internet/movil>
另請注意刪除路徑中的尾部斜線。
整個虛擬主機看起來像這樣:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName m.mores.es
DocumentRoot /var/www/internet/movil
<Directory /var/www/internet/movil>
Options Indexes FollowSymLinks Includes ExecCGI
DirectoryIndex index.php index.html
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/m.mores.es-error.log
CustomLog /var/log/apache2/m.mores.es-access.log combined
</VirtualHost>
重新載入apache,它應該可以工作
答案2
如果您碰巧啟用了 SELinux,那可能就是罪魁禍首。
sudo vim /var/log/audit/audit.log
或 sudo tail -f /var/log/audit/audit.log
和
sudo ls -Z /var/www/internet/movil/
使用 semanage fcontext 您可以修正這個問題。