Apache
安装 yum install httpd
启动service httpd start
停止service httpd stop
ps -ef | grep httpd
sudo netstat -anpl | grep ‘http‘
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
虚拟主机配置:
cd /etc/httpd
sudo vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
???????ServerName www.test.com
???????DocumentRoot /wwwroot/demo
???????<Directory "/wwwroot/demo">
???????????????Options Indexes FollowSymLinks
???????????????AllowOverride None
???????????????Require all granted
???????</Directory>
</VirtualHost>
mkdir -p /wwwroot/demo
index.html内容:
<html>
<head>
<meta charset="UTF-8">
<title>这是一个测试页面</title>
</head>
<body>
<h1>测试页面</h1>
</body>
</html>
hosts 文件
windows位置:C:\Windows\System32\drivers\etc\hosts
192.168.3.89 ?www.test.com
刷新 dns:ipconfig /flushdns
linux位置 /etc/hosts
tail -f access_log/error_log
chkconfig --list 显示开机可以自动启动的服务
chkconfig --add *** 添加开机自动启动***服务
chkconfig --del *** 删除开机自动启动***服务
chkconfig --list | grep httpd
httpd ??????????0:关闭 ?1:关闭 ?2:关闭 ?3:关闭 ?4:关闭 ?5:关闭 ?6:关闭
chkconfig --add httpd
//访问站点403错误原因:SELinux设置为开启状态(enabled)的原因
将SELINUX=enforcing 修改为 SELINUX=disabled 状态
vim /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
重启生效:reboot
sudo setenforce 0
sudo setenforce 0 //临时
Apache
原文地址:https://www.cnblogs.com/marshhu/p/9728949.html