打包到dist目录下
复制代码
npm run build
下载(解压到无中文空格的目录下)
复制代码
https://nginx.org/en/download.html
目录介绍
配置文件nginx.conf
复制代码
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
client_max_body_size 10m;
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~ /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://localhost:8080;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
重新加载配置文件再次访问localhost就OK了
复制代码
nginx.exe -s reload
关闭服务器
复制代码
nginx.exe -s stop
注意: