一、部署
1、yum安装:yum install -y htppd
2、源码安装:LAMP详细讲解。
3、查看安装产生的文件:
rpm -qa |grep httpd
rpm -ql httpd 显示主配置文件
二、启动
systemctl start httpd #启动apach服务
systemctl enable httpd #设置开机自启动
三、配置文件
主配置文件:/etc/httpd/conf/httpd.conf
默认网站根目录:/var/www/html,默认主页:index.html
访问日志:/var/log/httpd/access_log
错误日志:/var/log/httpd/error_log
常用参数及用途:
- ServerRoot 服务目录 /etc/httpd
- ServerAdmin 管理员邮箱
- User 运行服务的默认用户 yum安装,默认是apache;源码安装默认是:nobody
- Group 运行服务的默认用户组
- ServerName 网站服务器的域名,默认www.example.com:80 -->改为127.0.0.1:80,以提高重启时的响应速度。
- DocumentRoot