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; } } }
来源:https://www.cnblogs.com/jiftle/p/12305638.html