Nginx

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

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

问题描述

需要实现的是 多个域名访问同一服务器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;

    location / {
        proxy_pass http://IP地址; 
    }   
    }
server {
        listen 80;
        server_name www.域名.com;
睿共享
        i睿共享ndex index.html index.htm index.php;

        #error_睿共享page   404   /404.html;
   睿共享     location / {
            proxy_pass http://IP地址;
        } 
    }

0 条回应