-
Notifications
You must be signed in to change notification settings - Fork 90
Home
Fighter edited this page Jul 4, 2019
·
1 revision
- 前端部署到线上一般是执行
npm run build
打包,打包后nginx作为web服务器加载静态目录
# Ngninx 配置
server {
listen 80 default_server;
server_name localhost;
access_log /var/log/nginx/spug.access.log main;
error_log /var/log/nginx/spug.error.log;
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
location /api/ {
rewrite ^/api(.*)$ $1 break;
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
root /www/spug_web/dist;
}
error_page 404 =200 /index.html;
}