# -*- nginx -*- upstream wechat_socket { server 127.0.0.1:9235; # appserver_ip:ws_port } upstream shop_server { server 127.0.0.1:7878; } server { listen 80; server_name shop.com shopping.com www.shop.com www.shopping.com buy.com; root /Users/Can/Projects/shopping/else/static/; index index.htm; listen 443 ssl; ssl_certificate /Users/Can/Projects/shopping/else/config/server.crt; ssl_certificate_key /Users/Can/Projects/shopping/else/config/server.key; ssl_prefer_server_ciphers on; proxy_intercept_errors on; location ~ /(:wechat|:admin)/.*$ { proxy_pass http://wechat_socket; add_header From "Hunchensocket"; proxy_read_timeout 1000d; # 1000 day proxy_send_timeout 1000d; # 1000 day 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_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } location ~ ^/avatar/ { root /Users/Can/Projects/shopping/else/; try_files /$uri /$uri.jpg /$uri.png /$uri.svg @missing_avatar; } location @missing_avatar { return 301 /avatar/default.png; # /avatar/man; } location ~ ^/voice/ { root /Users/Can/Projects/shopping/else/; try_files /$uri /$uri.wav; } location ~ /(-|\+|api)/(?.*) { access_log /Users/Can/Projects/shopping/else/logs/smart.log.txt page; proxy_pass http://shop_server; # /$1?$args; add_header IP $remote_addr; add_header For Server; add_header X-Forwarde-For $proxy_add_x_forwarded_for; } location ~ ^/imgs?/(?.*) { root /Users/Can/Projects/shopping/else/imgs/; expires 30d; try_files /$file 404; } location ~ ^/icons { root /Users/Can/Projects/shopping/else/wechat/; } location ~ ^[^.]*$ { try_files /$file /index.htm; } location ~ ^/lib { root /Users/Can/Projects/js; add_header JS-type Library; expires 30d; } location ~ ^/canskit { root /Users/Can/Projects/js; } location ~ ^.*(js|htm|css)$ { # Keep the global root # kill cache # add_header Last-Modified $date_gmt; # add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; # if_modified_since off; add_header Cache-Control "max-age=0"; # 304 expires off; etag off; } }