Kestrel 服务器部署多站点问题 (nginx 反向代理)

Kestrel 作为微软的跨平台 web 服务器,有些地方用的好不是很熟。

作为一款嵌套到 dll 中的进程级 web 服务器,在同一台服务器上部署多站点确实还存在一点问题。

 

今天采用 nginx 做了一个反向代理解决一台 web 服务器部署多个基于 Kestrel 服务站点问题。

 

1、安装 nginx

  https://www.cnblogs.com/garfieldcgf/p/6438898.html

2、配置反向代理

  nginx 详细配置说明

  进入 nginx 安装目录  (gninx.conf 文件 http 节点下 include 的目录有个 *.conf 目录中去配置)

  cd /etc/nginx/conf.d

  vim 新增配置文件(根据反向代理的数量来新增配置数量)

  vim test-abc.com

server {
                listen 80;
                server_name test-abc.com;
                charset utf-8;
                location /
                 {
                        proxy_redirect off;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_pass http://127.0.0.1:8001;  # 自定义内部端口
                        error_page 404          /error/404.html;
                        error_page 502          /error/502.html;
                        error_page 400 401 402 403 503 504      /error/error.html;
                }
                location /error
                {
                        root /usr/local/nginx/html;
                }
        }

 

3、遇到的问题

部署起来后,可能是环境问题,总是报 500 的错误,看了下 niginx 的 error 日志,

什么鬼权限 failed (13: Permission denied) 问题,参考:

https://www.cnblogs.com/already/p/4680259.html

  

posted @ 2018-01-02 17:28  loongchao  阅读(1352)  评论(0编辑  收藏  举报