首页 > 其他 > 详细

nginx 设置多项目代理转发

时间:2020-12-14 18:43:35      阅读:33      评论:0      收藏:0      [点我收藏+]


user  nginx;
worker_processes  2;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;
    # 最大上传文件大小限制
    client_max_body_size 20M;

    #gzip  on;

    #include /etc/nginx/conf.d/*.conf;

    server {
    listen       80;
    server_name  192.168.1.123;

    #将/请求转发给http://127.0.0.1:8083/处理
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8083;
    }
    #将/project请求转发给http://127.0.0.1:8084/project处理
    location /project {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8084/project;
    }
}
}

nginx 设置多项目代理转发

原文:https://www.cnblogs.com/dashou/p/14134305.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!