upstream login_server{
server 127.0.0.1:19999;
}
upstream charge_server{
server 127.0.0.1:9999;
}
upstream web_server{
server 127.0.0.1:9090;
}
server {
listen 80;
listen 443 ssl;
server_name xxxx.cn;
# ssl on;
ssl_certificate /data/nginx_key/xxxx.cn.pem;
ssl_certificate_key /data/nginx_key/xxxx.cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
charset utf-8;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
location /(css|js|fonts|img)/ {
access_log off;
expires 1d;
root "/data/admin/views/static";
try_files $uri @backend;
}
location / {
try_files /_not_exists_ @backend;
}
location @backend {
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://web_server;
}
location ^~ /cdn/ {
alias /data/cdn/;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control max-age=864000;
}
location ~* ^/api/(.*)$ {
proxy_set_header Host $host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 当前的转发到
proxy_pass http://login_server/$1?$args;
}
location ~* ^/charge/(.*)$ {
proxy_set_header Host $host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 当前的转发到
proxy_pass http://charge_server/$1?$args;
}
}