问题:安装了apache后,修改/user/local/apache2/conf/httpd.conf文件中的documentroot参数,但访问的仍然是/var/www/html中的内容,即便是删除了该配置文件,apache也能正常启动。

 

所以问题的原因是apache的默认配置路径不是ser/local/apache2/conf/httpd.conf,而是/etc/httpd/conf/httpd.conf。

 

----补充说明-----------------------

 

在修改/etc/httpd/conf/httpd.conf中的DocumentRoot后,如果重启apache出下如下错误:

DocumentRoot must be a directory

 

这是因为是使用了SELinux,有两种方法解决:

 

方法一:禁止使用SELinux,运行:
system-config-securitylevel (或 redhat-config-securitylevel)

来禁止对http的SELinux设置。

 

方法二:或给新路径设置SELinux权限:
chcon -R -h -t httpd_sys_content_t /wwwroot

GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐