Nginx

通过Nginx代理一台服务器 实现多个域名访问同一IP地址

rzk · 3月5日 · 2022年本文共393个字 · 预计阅读2分钟164次已读

问题描述

需要实现的是 多个域名访问同一服务器ip:80端口
默认http:/睿共享/域名.com是80端口
在项目中需要使用域名访问,不可能让人使用一串难输入的数字去访问你的网站

解决方法

这里就需要用到nginx代理服务
以下贴主要配置

server
    {
        listen 80;
        server_name www.域名.com;
睿共享
        index index.html index.htm index.php;

        #error_page   404   /404.html;
        include enable-php.conf;

    lo睿共享cation / {
        proxy_pass http://IP地址; 
    }   
    }
server {
        listen 80;
        server_name www.域名.com;
        index index.html index.htm index.p睿共享hp;

        #error_page   404   /404.html;
        location / {
            proxy_pa睿共享ss http://IP地址;
        } 
    }

0 条回应