#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; upstream gateway { # 接口访问地址 server 172.26.218.204:8800; } server { listen 80; server_name wine.gzzzyd.com; rewrite ^/(.*)$ https://wine.gzzzyd.com:443/$1 permanent; } # another virtual host using mix of IP-, name-, and port-based configuration # HTTPS server # server { listen 443 ssl; server_name wine.gzzzyd.com; root /usr/local/nginx/dist; # 后台访问路径 keepalive_timeout 100; # 长连接 100s ssl_certificate /usr/local/ssl/nginx/server.pem; ssl_certificate_key /usr/local/ssl/nginx/server.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; location / { index index.html index.htm; } # 接口访问地址 域名 + /api location ^~/api { 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; rewrite ^/api/(.*)$ /$1 break; proxy_pass http://gateway; } } }