- 由于公司给部门分配的端口数量有限,外网使用较为麻烦,因此采用代理服务进行转发。
- 要求每个项目必须拥有合适的项目名称,如:http//:www.xxx.com/项目名,且这些服务站点都不可被外网访问,统一进行代理服务配置。
- 对于有上传大文件需求,client_max_body_size 上传设置文件大小。
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
pid logs/nginx.pid;
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;
client_max_body_size 500M;
server {
listen 8111;
server_name service.xxxx.cn;
port_in_redirect on;
proxy_set_header Host $host:8111;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location /jfpt {
proxy_pass http://localhost:3110/jfpt;
}
location /core {
proxy_redirect off;
proxy_pass http://localhost:1981/core;
}
location /fams {
proxy_redirect off;
proxy_pass http://localhost:1981/fams;
}
}
}