基本操作
// 安装
yum install httpd
// 启动
service httpd start
// 停止
service httpd stop
查询进程是否存在
ps -ef | gref httpd
查询端口是否监听
sudo netstat -anpl | grep 'http'
配置虚拟主机
cd /etc/httpd/conf
vim httpd.conf
<VirtualHost *:80>
ServerName www.hello.test
DocumentRoot /data/www
<Directory "/data/www">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
重启服务器
service httpd restart
建立根目录
sudo mkdir -p /data/www
新建index.html并提权
sudo chown -R user1:user1 /data
vim index.html
设置为宽松模式
// 在配置中设置
sudo vim /etc/selinux/config
sudo setenforce 0