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.
- 要检查
www/http对apache用户的访问权限。 - 检查
SELinux访问权限。开启访问权限命令为setsebool -P httpd_read_user_content 1









网友评论