Apache
安装Apache服务
yum install httpd -y启动服务并加入开机启动项
systemctl start httpd
systemctl enable httpd验证启动是否成功
# 在浏览器中打开下方地址:
# 若返回Apache服务的默认页面则服务启动成功
http://127.0.0.1配置服务参数说明
httpd服务在Linux系统中的配置文件
配置文件名称
存放位置
服务目录
/etc/httpd
主配置文件
/etc/httpd/conf/httpd.conf
个人主页配置文件
/etc/httpd/conf.d/userdir.conf
网站数据目录
/var/www/html
访问日志
/var/log/httpd/access_log
错误日志
/var/log/httpd/error_log
httpd服务常用参数
参数
用途
ServerRoot
服务目录
ServerAdmin
管理员邮箱
User
运行服务的用户
Group
运行服务的用户组
ServerName
网站服务器的域名
DocumentRoot
网站数据目录
Listen
监听的IP地址与端口号
DirectoryIndex
默认的索引页页面
ErrorLog
错误日志文件
CustomLog
访问日志文件
Timeout
网页超时时间,默认为300秒
自定义网站数据目录
测试默认首页
创建自定义网站数据目录及首页文件
修改httpd主配置文件
配置SELinux 上下文
重启服务
访问测试
Last updated