我爱编程

CentOS 7 中 apache 配置问题

2016-10-08  本文已影响210人  十月汪

CentOS 7 中, apache 版本为 2.4 ,配置细节有所不同。

配置文件

/etc/httpd/conf/httpd.conf 是配置文件。

DocumentRoot

默认所有的请求都从该文件夹访问。也可用符号链接此处。

DocumentRoot "/var/www/html"

设置访问默认文件

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

开启、关闭、重启 apache

$ apachectl start
$ apachectl stop
$ apachectl restart
$ apachectl status

日志文件

apache 日志文件位于 /var/log/httpd/error_log

访问权限

如果出现 Forbidden You don't have permission to access on this server.

  1. 要检查 www/httpapache 用户的访问权限。
  2. 检查 SELinux 访问权限。开启访问权限命令为 setsebool -P httpd_read_user_content 1
上一篇 下一篇

猜你喜欢

热点阅读