CentOS下Apache简单配置方法
配置环境:CentOS 8.1 (此处省略yum源配置方法)
安装httpd服务
# yum -y install httpd*
退回到根目录
# cd
创建站点(此处以hubeijnds为例)
# mkdir -p /www/hubeijnds
给我们创建的站点进行授权
# chmod -R 775 /www/hubeijnds/
自定根网站内容
# vim /www/hubeijnds/index.htm
// 这里网站的内容可以自定义 和windows中相同
查看根网站是否创建完成
# ls /www/hubeijnds/
进入httpd.conf配置文件
# vim /etc/httpd/conf/httpd.conf(在配置文件的最后添加)
<Virtualhost 192.168.1.10:80>
DocumentRoot /www/hubeijnds
Namevirtualhost 192.168.1.10:80
ServerName 192.168.1.10:80
DirectoryIndex index.htm
<Directory "/www/hubeijnds">
AllowOverride None
Require all granted
</Directory>
</Virtualhost>
关闭所有防火墙
# iptables -F
# stenforce 0
# systemctl enable firewalld
进入配置文件/selinux/config
# vim /etc/selinux/config
SELINUX=enforcing //将enforcing更改成disabled
重启httpd服务
# systemctl restart httpd
重启完成后 无报错 进入Firefix输入本机ip可看到我们的网站
可在配置完Yum源后就将防火墙全部关闭