nginx代理域名访问

/ nginx / 没有评论 / 1381浏览

nginx代理域名访问

host文件修改

首先将域名映射为nginx的服务器

127.0.0.1 service.tourbida.com

nginx域名代理

将域名代理到另外一个域名.

server {
    listen 80;
    server_name service.tourbida.com;
    location / {
        # 代理到具体IP
        # proxy_pass http://127.0.0.1:6888/;
        # 代理到某个域名
        proxy_pass http://service.tbd.yanzuoguang.com/;
        proxy_redirect off;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}