搭建网站httpd

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;

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值