yum -y install httpd:通过yum下载httpd;
systemctl start httpd :启动httpd服务;
systemctl status httpd :查看httpd状态;
systemctl restart httpd: 重启服务
systemctl stop httpd: 停止服务;
制作简单的网页:
cd /var/www/html
echo "This is my first website." > index.html
内部打开:
firefox 192.168.0.103;
外部打开:
firewall-config :http打个勾,此时应该可以从windows访问Linux中的web服务器,关闭防火墙;
浏览器输入IP;
修改配置文件:
cd /;
cd /etc/httpd/conf;
vim httpd.conf : 改配置文件
:set nu :设置行号;
:42 :光标移到42行;
y y p :复制粘贴,Listen 80;
Listen 8088 :新增端口
<VirtualHost 192.168.0.103:8088> //新加3行
DocumentRoot "/var/www/html2"
</VirtualHost>
Shift z z:保存退出;
制作一个新的网页:
cd /var/www/
mkdir html2;
cd html2;
echo "This is my seconde website." > index.html
setenforce 0:关闭第二重防火墙;
systemctl restart httpd: 重启服务;
firewall-config : 端口->添加->8088;
Firefox 192.168.0.101:8088;