1、查看httpd包是否可用:
# yum list | grep httpd
2、安装Apache
# yum install httpd
3、配置
# 主配置文件
# vi /etc/httpd/conf/httpd.conf
项目配置可以单独在/etc/httpd/conf.d路径下创建‘.conf’文件(名字自己随便起)
<VirtualHost *:80>
DocumentRoot "/home/www"
ServerName localhost:80
<Directory "/home/www">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
4 命令
service httpd start
service httpd stop
service httpd restart
5 设置开机自动启动:
chkconfig httpd on
在httpd服务程序主配置文件中最为常用的参数如下:
ServerRoot 服务目录
ServerAdmin 管理员邮箱
User 运行服务的用户
Group 运行服务的用户组
ServerName 网站服务器的域名
DocumentRoot 网站数据目录
Listen 监听的IP地址与端口号
DirectoryIndex 默认的索引页页面
ErrorLog 错误日志文件
CustomLog 访问日志文件
Timeout 网页超时时间,默认为300秒.
Include 需要加载的其他文件