记录一下配置
跨域
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| add_header Access-Control-Allow-Methods *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Allow-Credentials false;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Headers $http_access_control_request_headers;
if ($request_method = OPTIONS){ return 200; }
|
ssl
1 2 3 4 5 6 7 8 9 10
| listen 443 ssl; server_name lixianglin.com; client_max_body_size 15M; ssl_certificate cert/7454185_www.xxxx.com.pem; ssl_certificate_key cert/7454185_www.xxx.com.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on;
|
转发请求
1 2 3 4 5
| location ^~ /prod-api/ { proxy_pass http://127.0.0.1:8080/; proxy_connect_timeout 6000; proxy_read_timeout 6000; }
|
gzip
1 2 3 4 5 6 7 8 9 10 11
| html{ gzip on; gzip_static on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 8; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript; gzip_vary on; gzip_disable "MSIE [1-6]\."; }
|
vue-router
解决vue-router history 模式刷新404
1 2 3 4 5 6 7 8 9 10
|
location / { try_files $uri $uri/ /index.html; }
location /manager/ { try_files $uri $uri/ /manager/index.html; }
|