首页 > 其他 > 详细

nginx配置反向代理

时间:2020-02-14 01:04:54      阅读:74      评论:0      收藏:0      [点我收藏+]

nginx配置反向代理

# 运行用户
user  nginx;
# 工作者进程
worker_processes  1;

## 日志
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


## 工作模式和连接数上限
events {
    worker_connections  1024;
}

# 设定http服务器
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;

    #gzip  on;

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

server {
    listen       80;
    server_name  .a.com;

    charset utf-8;
    access_log  /var/log/a.com.access.log;

location / {
    try_files /_not_exists_ @backend;
}

    location @backend {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host            $http_host;

        proxy_pass http://127.0.0.1:9080;
    }
}

}

nginx配置反向代理

原文:https://www.cnblogs.com/jiftle/p/12305638.html

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