运行环境
CentOS7
nginx-1.16.1
Nginx安装位置
/usr/local/nginx
部署静态页面
准备两个静态页面:添加页面(add)和修改页面(update)
静态页面结构
移动静态页面
将add和update两个文件夹移动至 /usr/local/nginx/下
修改hosts文件
在C:\Windows\System32\drivers\etc\hosts文件最后一行添加如下内容
192.168.17.129 add.xuecheng.com
192.168.17.129 update.xuecheng.com
修改配置文件
文件位置:/usr/local/nginx/conf/nginx.conf
server {
listen 80;
server_name add.xuecheng.com;
location / {
#add文件夹存放静态页面
root add;
index add.html;
}
}
server {
listen 80;
server_name update.xuecheng.com;
location / {
root update;
index update.html;
}
}
页面访问
浏览器访问
#访问添加页面
add.xuecheng.com
#访问修改页面
update.xuecheng.com