使用 Nginx 来反向代理多个 NoderCMS

Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由Igor Sysoev为俄罗斯访问量第二的Rambler.ru站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名
 

1. 进入 Nginx 配置目录

$ cd /etc/nginx/conf.d

注:此为 Centos 的默认配置目录,不同平台默认目录可能不同

2. 新建 nginx 配置文件并保存,如下所示:

server {
    listen 80;
    server_name www.nodercms.com;
    location / {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:3002;
    }
}

保存为 /etc/nginx/conf.d/my-nodercms.conf

3. 重启 nginx

原文地址:https://www.cnblogs.com/welkinwong/p/5963090.html