ubuntu下apache2環境問題

1.啓動問題

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

當start/restart時出現上述問題,到/etc/apache2/apache2.conf中,添加一行即可解決

Servername localhost:80

2.修改默認站點路徑
vim /etc/apache2/sites-enabled/000-default.conf
修改DocumentRoot

DocumentRoot /var/www/html  #修改成自己的路徑

之後記得重啓apache服務

3.修改默認站點路徑出現403問題
本人在兩個ubuntu版本上用同樣的方法配過,13.10沒問題,但14.10就出現403權限問題。解決方法:
依舊到/etc/apache2/apache2.conf配置文件中找

<Directory /var/www/html/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

發現Directory標籤路徑沒改動,因此,改爲之前第2步中修改的DocumentRoot路徑,restart後問題解決。

//2015.12.13更新
在CentOS下,記得對httpd的conf配置文件中,修改httpd的啓動用戶與組,找到User apache與Group apache,修改爲自己的用戶名與組即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章