一:准备
1.关闭防火墙,安装nginx与httpd-tools,并启动。
[root@server ~]# systemctl start nginx # 启动nginx
[root@server ~]# systemctl enable nginx # 设置开机启动
2.在window中C:\Windows\System32\drivers\etc\hosts完成DNS映射。
用记事本打开,在最后一行加上IP地址与域名。
二:创建www.openlab.com网站
1.创建网页目录
![](https://img-blog.csdnimg.cn/direct/c0811e4541f9451587e0b1bf6af8e561.png)
2.写入内容
3.更改nginx.conf文件中的设置
![](https://img-blog.csdnimg.cn/direct/b0116c75c926453295a009ab0daaa979.png)
![](https://img-blog.csdnimg.cn/direct/6e2cf0b1e8574884bc1700b2441c7035.png)
更改完,点击Esc,输入:wq ,保存并退出
4.重启nginx
![](https://img-blog.csdnimg.cn/direct/0c739c98511e4d52a63830ceb5318d40.png)
5.进入网站测试
![](https://img-blog.csdnimg.cn/direct/ca9bd05810b1419088bc40e60ae8d073.png)
因为前面输入内容时内容忘记更改,但问题不大,继续。