1、准备服务端(这里我采用OpenEuler系统)
2、具体配置
#下载nginx
[root@csa ~]# yum install nginx -y
#关闭防火墙
[root@csa ~]# systemctl stop firewalld
[root@csa ~]# setenforce 0
#修改配置文件
[root@csa ~]# vim /etc/nginx/conf.d/test_name.conf
server {
listen 192.168.137.140;22;
root /www/name/node1;
server_name www.openlab.com;
location / {
}
}
#创建网页目录
[root@csa ~]# mkdir -pv /www/name/node1
#写入网页内容
[root@csa ~]# vim /www/name/node1/index.html
welcome to openlab!!!
#重启nginx
[root@csa ~]# systemctl restart nginx
在windows系统上以管理员身份打开记事本,编辑C:\Windows\System32\drivers\etc\hosts文本,末行添加如下信息
192.168.137.129 www.openlab.com