ECS配置ngnix代理
server{ listen 80;server_name 域名; #server_name end index index.php index.html index.htm; #index end add_header Strict-Transport-Security 'max-age=63072000; includeSubdomains; preload'; set $subdomain ''; root 路径$subdomain; #error_page error_page 401 /ErrorPages/401.html; error_page 403 /ErrorPages/403.html; error_page 404 /ErrorPages/404.html; error_page 503 /ErrorPages/503.html; #location ~ /ErrorPages/(400|401|403|404|405|502|503)\.html$ location / { proxy_redirect off ; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 50m; client_body_buffer_size 256k; proxy_connect_timeout 30; proxy_send_timeout 30; proxy_read_timeout 60; proxy_buffer_size 256k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_temp_file_write_size 256k; proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; proxy_max_temp_file_size 128m; proxy_pass http://127.0.0.1:8081/;#本地应用地址 } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$ { expires 30d; } location ~ .*\.(js|css)$ { expires 12h; }}
从我们主机抄的,我简略了一下,大致是这样,没测过。你试试吧。
赞0
踩0