# -*- nginx -*- log_format fx_log ' $remote_addr => $host | $request $status | [$time_iso8601] $request_uri $http_user_agent'; upstream fx_socket { server 127.0.0.1:56789; # appserver_ip:ws_port } upstream fx_http { server 127.0.0.1:45678; } server { listen 80; server_name fx.com; root /Users/Can/every-lisp/fan-xuan/admin/; 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; set $fx_dir /Users/Can/every-lisp/fan-xuan; location ~ /(:wechat|:admin)/.*$ { proxy_pass http://fx_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 ~ /(-|\+|api)/(?.*) { access_log /Users/Can/Develop/nginx/fx.log.local.txt fx_log; proxy_pass http://fx_http; # /$1?$args; add_header IP $remote_addr; add_header For Server; add_header X-Forwarde-For $proxy_add_x_forwarded_for; } location = /imgs/loading { rewrite ^ http://fx.celwk.com/imgs/loading.png; } location ~ ^/imgs?/(?.*) { root $fx_dir/imgs/; # expires 30d; try_files /$file /$file.png /$file.jpg /$file.jpen 404; } location ~ ^/(?admin|avatar)/ { root $fx_dir/imgs/; try_files /$uri /$uri.jpg /$uri.jpeg /$uri.png /$uri.svg /$type/default; } location ~ ^/icons { root $fx_dir/wechat/; } location ~ ^/lib { root /Users/Can/Projects/js; add_header JS-type Library; add_header Access-Control-Allow-Origin "$http_origin"; expires 2h; } 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=100"; # 304 expires off; etag off; } location = /favicon.ico { root $fx_dir/imgs/logo/; # try_files /gray-icon.ico /favicon.ico; } location ~ ^[^.]*$ { try_files /$file /index.htm; } }