nginx 之特殊端口转目录访问
#user root;
worker_processes 16;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr $http_X_Forwarded_For [$time_local] '
'$upstream_addr $upstream_response_time "$request_time" '
'$http_host $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_accept_language" "$http_user_agent" ';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream api {
server 127.0.0.1:89;
}
upstream record {
server 127.0.0.1:90;
}
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
server {
listen 80;
listen 443 ssl;
server_name demorecord.nwg999.com;
ssl_certificate /etc/ssl/STAR.ash521.com.crt;
ssl_certificate_key /etc/ssl/STAR.ash521.com.key;
ssl_session_timeout 50m;
ssl_protocols TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location =/record {
proxy_pass http://record;
proxy_connect_timeout 300;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
proxy_read_timeout 700;
proxy_send_timeout 700;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
server {
listen 80;
listen 443 ssl;
server_name demoapi.ash521.com;
ssl_certificate /etc/ssl/STAR.nwg999.com.crt;
ssl_certificate_key /etc/ssl/STAR.ash521.com.key;
access_log /var/log/nginx/demoapi.ash521.com.log main;
ssl_session_timeout 50m;
ssl_protocols TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location ~* /game {
proxy_pass http://api;
proxy_connect_timeout 300;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
proxy_read_timeout 700;
proxy_send_timeout 700;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
}