centos7下apache配置

1、安装
yum -y install httpd

2、防火墙开放端口
firewall-cmd --zone=public --add-port=80/tcp --permanent

3、目录文件信息
服务目录 /etc/httpd
主配置文件 /etc/httpd/conf/httpd.conf
网站数据目录 /var/www/html
访问日志 /var/log/httpd/access_log
错误日志 /var/log/httpd/error_log

4、常用配置属性
ServerRoot 服务目录
ServerAdmin 管理员邮箱
User 运行服务的用户
Group 运行服务的用户组
ServerName 网站服务器的域名
DocumentRoot 网站数据目录
Listen 监听的IP地址与端口号
DirectoryIndex 默认的索引页页面
ErrorLog 错误日志文件
CustomLog 访问日志文件
Timeout 网页超时时间,默认为300秒.
Include 需要加载的其他文件

5、配置虚拟主机,可以基于主机、端口和IP
httpd.conf在/etc/httpd/conf下,默认自动引用 /etc/httpd/conf.d/下的所有.conf文件所以我们把 vhost.conf建立在 /etc/httpd/conf.d/目录下

cd /etc/httpd/conf.d/
vi vhost.conf  ,内容如下
<VirtualHost *:80>  
	ServerAdmin service@xxx.cn  
	directoryIndex  index.html index.php index.htm  
	ServerName x.xxx.net  
	DocumentRoot /www/web  
	<Directory "/www/web">  
		Options -Indexes		  
		AllowOverride All		  
		Require all granted  
	</Directory>  
</VirtualHost>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值