# -*- nginx -*- log_format ls_log ' $remote_addr => $host | $request $status | [$time_iso8601] $request_uri $http_user_agent'; upstream ls_socket { server 127.0.0.1:1989; # appserver_ip:ws_port } upstream ls_http { server 127.0.0.1:9999; } server { listen 80; server_name house.com ls.com ls.cn; root /Users/Can/lvshang/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 $ls_dir /Users/Can/lvshang; location ~ /(:wechat|:admin)/.*$ { proxy_pass http://ls_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/house.log.local.txt ls_log; proxy_pass http://ls_http; # /$1?$args; add_header IP $remote_addr; add_header For Server; add_header X-Forwarde-For $proxy_add_x_forwarded_for; } location ~ ^/(sheet|poster|qr|attachment)/ { root /Users/can/lvshang/build/; add_header What-Is-It Attachment; try_files /jd/$uri /jd/$uri.jpg /jd/$uri.png /ali/$uri /ali/$uri.jpg /ali/$uri.png 404; } location ~ ^/spider { root /Users/can/lvshang/; } location ~ ^/(files|upload) { root $ls_dir; } location = /imgs/loading { rewrite ^ http://house.celwk.com/imgs/loading.png; } location ~ ^/imgs?/(?.*) { root $ls_dir/imgs/; expires 30d; try_files /$file /$file.png /$file.jpg /$file.jpen 404; } location ~ ^/svg/ { root /Users/Can/Pictures/; expires 30d; # try_files /$file /$file.png /$file.jpg /$file.jpen 404; } location @missing_avatar { return 301 /avatar/default.png; # /avatar/man; } location ~ ^/avatar/? { root $ls_dir/imgs/; try_files /$uri /$uri.jpg /$uri.png /$uri.svg @missing_avatar; } location ~ ^/icons { root $ls_dir/wechat/; } # location ~ ^/ui/svg/(?.*)$ { # root $ls_dir/imgs; # try_files /svg/$file 404; # } 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 $ls_dir/imgs/logo/; try_files /gray-icon.ico /favicon.ico; } location ~ ^[^.]*$ { try_files /$file /index.htm; } }