1、修改vue.config.js
publicPath: ‘/’,改为 publicPath: ‘./’,
2、 outputDir: ‘dist’,改为 outputDir: ‘dist/html’,
3、nginx配置文件
#load_module /app/servers/nginx/modules/ngx_stream_module.so;
#user mwop mwop;
worker_processes 2;
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 10240;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
gzip on;
gzip_min_length 1k;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/css text/xml application/javascript application/atom+xml application/rss+xml text/plain application/json application/x-javascript application/xml text/javascript;
gzip_disable "MSIE [1-6].";
gzip_vary on;
client_max_body_size 100m;
proxy_http_version 1.1;
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 1M;
proxy_busy_buffers_size 2M;
rewrite_log on;
log_format access '$remote_addr:$remote_port - $server_addr:$server_port $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_length $msec $connection $upstream_addr '
'$upstream_response_time $request_time "$http_cookie"';
access_log logs/access.log access;
sendfile on;
keepalive_timeout 65;
upstream admin {
ip_hash;
server 10.104.10.36:8081;
}
server {
# listen 0.0.0.0:8080;
listen 80;
server_name 10.136.1.11x;
location /budget/admin/html {
alias /app/budget/web/dist/html;
index index.html index.htm;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
allow 10.0.0.0/8;
allow 100.0.0.0/8;
allow 10.0.0.0/24;
deny all;
}
location /base {
proxy_pass http://admin;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
更多技术文章请关注公众号:架构师Plus,
扫码添加



