一。安装:

参考资料:

二。配置

1.纯页面配置:

#user  nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;




events {
worker_connections 1024;
}






http {
include 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 logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;


server {
listen 8888;
server_name XXXXXX;

location / {




root /usr/local/nginx/html/;
index index.html index.php;


proxy_pass http://XXXXXX:7322/;#http服务地址,复杂需要可配置upstream
}
}
}

2.有服务的一方:

location /project/ {  
#proxy_redirect off;
proxy_redirect http://localhost http://localhost:8082;
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_pass http://IP本地地址:8080/project/;

}