咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
yum install -y epel-* yum isntall -y nginx vim
mkdir /var/wwwroot mkdir /var/wwwroot/site1 mkdir /var/wwwroot/site2 echo -e "site1" >> /var/wwwroot/site1/index.html echo -e "site2" >> /var/wwwroot/site2/index.html
setenforce 0 systemctl stop firewalld systemctl disable firewalld
vim /etc/nginx/conf.d/vhosts.conf
server { listen 8081; root /var/wwwroot/site1; index index.html; location / { } } server { listen 8082; root /var/wwwroot/site2; index index.html; location / { } }
nginx
服务systemctl start nginx
http://www.landui.com:8081/
http://www.landui.com:8082/
vim /etc/nginx/conf.d/vhosts.conf
server { listen 80; server_name site1.test.com; root /var/wwwroot/site1; index index.html; location / { } } server { listen 80; server_name site2.test.com; root /var/wwwroot/site2; index index.html; location / { } }
nginx
服务systemctl restart nginx
hosts
文件编辑C:\Windows\System32\drivers\etc\hosts
文件,
添加以下内容(根据实际情况自己修改)
192.168.204.135 site1.test.com 192.168.204.135 site2.test.com
http://www.landui.com/
http://www.landui.com/
ifconfig ens33:1 192.168.204.151 ifconfig ens33:2 192.168.204.152
vim /etc/nginx/conf.d/vhosts.conf
server { listen 192.168.204.151:80; root /var/wwwroot/site1; index index.html; location / { } } server { listen 192.168.204.152:80; root /var/wwwroot/site2; index index.html; location / { } }
nginx
服务systemctl restart nginx
http://www.landui.com/
http://www.landui.com/