Ubuntu16.04 apache2.4 修改默认根目录
2017-01-14 02:13
1271 查看
Ubuntu16.04 默认 apt-get install apache2 安装的apache2.4
apache2.4配置根目录文件在
/etc/apache2/sites-available/000-default.conf
默认是 var/www/html
可以改成想要的目录,比如/home/judge/etc/web
默认主页的配置在
/etc/apache2/mods-available/dir.conf
可以为如下格式:index.html index.cgi index.pl index.php index.xhtml index.htm
可以修改为 ***.html等
2017.8.3更新:
修改默认根目录之后会报两个错误
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.158.209. Set the 'ServerName' directive globally to suppress this message
以及
访问localhost:80 报 404 You don't have permission to access / on this server.
解决办法:
第一个问题: 其实提示中已经说了让set ServeerName,所以
在/etc/apache2目录下,打开apache2.conf文件,加一句:ServerName localhost:80
第二个问题:
网页上显示404说没有权限访问这个服务器
还是apache2.conf文件,找到
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
#Require all denied
</Directory>
把Require all denied这一句注释掉,加上 allow from all
最后重启apache,发现已经正常了。
参考http://httpd.apache.org/docs/2.4/
apache2.4配置根目录文件在
/etc/apache2/sites-available/000-default.conf
默认是 var/www/html
可以改成想要的目录,比如/home/judge/etc/web
默认主页的配置在
/etc/apache2/mods-available/dir.conf
可以为如下格式:index.html index.cgi index.pl index.php index.xhtml index.htm
可以修改为 ***.html等
2017.8.3更新:
修改默认根目录之后会报两个错误
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.158.209. Set the 'ServerName' directive globally to suppress this message
以及
访问localhost:80 报 404 You don't have permission to access / on this server.
解决办法:
第一个问题: 其实提示中已经说了让set ServeerName,所以
在/etc/apache2目录下,打开apache2.conf文件,加一句:ServerName localhost:80
第二个问题:
网页上显示404说没有权限访问这个服务器
还是apache2.conf文件,找到
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
#Require all denied
</Directory>
把Require all denied这一句注释掉,加上 allow from all
最后重启apache,发现已经正常了。
参考http://httpd.apache.org/docs/2.4/
相关文章推荐
- Ubuntu16.04 apache2.4 修改默认根目录
- ubuntu 下修改apache的默认端口与根目录
- linux -- ubuntuserver 安装Apache后,修改默认目录和分布式配置文件可执行
- ubuntu14.04 apache修改网站根目录以及默认网页
- Ubuntu 15下 Apache修改网站根目录及默认网页
- ubuntu14.04 apache修改网站根目录以及默认网页
- ubuntu 下修改apache的默认端口与根目录
- Ubuntu 14.04下Apache修改网站根目录及默认网页
- ubuntu 修改apache2 默认网站目录和默认主页文档以及连接phpmyadmin
- Ubuntu16.04与Windows双系统修改默认开机启动顺序
- ubuntu vps直接修改默认目录地址导致无法进入wordpress的解决方法
- 修改Apache默认访问目录
- 修改Apache默认访问目录
- Ubuntu 16.04修改Home目录下的中文目录为英文
- apache修改默认目录后访问拒绝
- Ubuntu下修改Apache默认页面类型的顺序
- Python: linux Ubuntu 16.04 下Jupyter notebook改变默认目录路径
- ubuntu下修改用户的默认目录
- Ubuntu中Apache修改DocumentRoot(修改网站根目录)
- Ubuntu16.04如何修改Python默认版本