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,修改为自己的用户名与组即可。

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