Nginx配置
Posted keepsilence
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx配置相关的知识,希望对你有一定的参考价值。
user www-data; worker_processes auto; pid /run/nginx.pid; events { use epoll; worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; keepalive_timeout 65; upstream backend { #ip_hash; server 192.168.0.81:8088; server 192.168.0.96:8089; } server { listen 80; server_name 2; location / { #设置主机头和客户端真实地址,以便服务器获取客户端真实IP proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #禁用缓存 proxy_buffering off; #反向代理的地址 proxy_pass http://backend; } } }
以上是关于Nginx配置的主要内容,如果未能解决你的问题,请参考以下文章
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段