手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

Centos7虚拟机上用Apache搭建网站

时间:2024-10-12 08:44:01

1、安装Apache服务:yum install httpd -y

Centos7虚拟机上用Apache搭建网站

2、重启Apache服务:systemctl restart httpd防火墙放行80端口(Apache服务默认使用80端口)firewall幻腾寂埒-cmd --add-port=80/tcp --permanent firewall-cmd --reload

Centos7虚拟机上用Apache搭建网站

3、查看虚拟机ip地址:ipaddress可以看到我虚拟机ip地址为:192.168.141.53

Centos7虚拟机上用Apache搭建网站

4、接下来在自己电脑浏览器上访问虚拟机的ip地址,例如我的ip是192.168.141.53,打开后可以看到如下图这个测试页面:

Centos7虚拟机上用Apache搭建网站

5、上一步骤中的“Test坡纠课柩ing 123”测试页面是网站的默认页面,接下来我们到网站根目录下写一个index.html作为我们网站的首页。例如我在index.html内写入:hello! my new website!

Centos7虚拟机上用Apache搭建网站

6、重启Apache服务:systemctl restart httpd

Centos7虚拟机上用Apache搭建网站

7、接下来在自己电脑浏览器上刷新刚刚访问的虚拟机的ip地址,刷新后就可以看到我们刚刚写好的新网页了

Centos7虚拟机上用Apache搭建网站

8、如果网站含有多媒体文件例如视频音频图片等,则可以用WinSCP或者rz、sz等工具上传相关文件。一般离线的网站测试完毕后,上传到虚拟机或者服务器可以理解为“网站正式上线”。

© 手抄报圈