Nginx 一个端口号映射多个域名

nginx.conf文件中配置多个server即可:

user nobody;
worker_processes 4;
events{
	worker_connections 1024;
}
http{
		# upstream 是实现负载均衡功能的属性
        upstream web{
	    	server 192.168.43.10;
        	server 192.168.43.11;
        }
        
        # www.web1.com
        server{
                listen 80;
                server_name www.web1.com;
                location / {
                	proxy_pass http://web;
                }
        }
        
        # www.web2.com
        server{
                listen 80;
                server_name www.web2.com;
                location / {
					root html/;
            		index index.html;
                }
        }
}

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 创作都市 设计师:CSDN官方博客 返回首页