一、设置 conf/nginx-conf文件
server {
listen 3000;
server_name localhost;
root html/dist;
#charset koi8-r;
#access_log logs/host.access.log main;
location /api/ {
proxy_pass xxxxxxxxxxxxxxxxxx;
}
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
二、服务器启动
在sbin目录下 start nginx
三、服务器重启
./sbin/nginx -s reload
四、查看服务日志
在log目录下,tail -f error.log (查看错误日志)