apache 错误

1、系统的提示是

Forbidden

You don't have permission to access / on this server.
Apache/2.2.3 (Ubuntu) PHP/5.2.1 Server at localhost Port 80

解决方法:

chmod -R 777 /var/www/(此为apache2的默认DocumentRoot,如没改变,就是这样输入即可,但可惜在Ubuntu下,你每新增一个文件,都要chmod一下,十分不方便)

我的做法就是:在***/home/下新建一目录www,然后sudo gedit /etc/apache2/sites-available/default 把DocumentRoot改为**/home/www/,再sudo apache2 -k restart即可。

2、在启动apache2时候,提示 httpd: apr_sockaddr_info_get() failed for linux

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(9Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

解决方法:

sudo gedit /etc/apache2/httpd.conf ,加入ServerName *****即可。