# -*- nginx -*- log_format house_log ' $remote_addr => $host | $request $status | [$time_iso8601] $request_uri $http_user_agent'; upstream house_socket { server 127.0.0.1:1989; # appserver_ip:ws_port } upstream house_http { server 127.0.0.1:9999; } server { listen 80; server_name house.com; # root /Users/Can/house/static; root /Users/Can/Projects/house/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 $house_dir /Users/Can/Projects/house; location ~ /(:wechat|:admin)/.*$ { proxy_pass http://house_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 house_log; proxy_pass http://house_http; # /$1?$args; add_header IP $remote_addr; add_header For Server; add_header X-Forwarde-For $proxy_add_x_forwarded_for; } location ~ ^/table/ { root /Users/can/spider/; try_files /$uri /$uri.jpg /$uri.jpeg /$uri.png 404; } location = /imgs/loading { rewrite ^ http://house.celwk.com/imgs/loading.png; } location ~ ^/imgs?/(?.*) { root $house_dir/imgs/; 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 $house_dir/imgs/; try_files /$uri /$uri.jpg /$uri.png /$uri.svg @missing_avatar; } location ~ ^/icons { root $house_dir/wechat/; } # location ~ ^/ui/svg/(?.*)$ { # root $house_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 $house_dir/imgs/logo/; try_files /gray-icon.ico /favicon.ico; } location ~ ^/ref/(?.*)$ { resolver 8.8.8.8; proxy_set_header Host huoban.com; proxy_pass https://st2100000014231512.huoban.com/$link; add_header Host huoban.com; } location ~ ^[^.]*$ { try_files /$file /index.htm; } }