常用命令
cd e:\Nginx
cd nginx-1.16.1
start nginx
tasklist /fi "imagename eq nginx.exe" //查看进程
nginx -t -c ./conf/nginx.conf //检查配置文件
nginx -s reload //重启服务
nginx -s stop //快速停止
nginx -s quit //完整有序的停止
常用配置
server {
listen 80;
server_name test.wztlink1013.com;
#server_name test.wztlink1013.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root E:\\mly\\ad_dist;
#root E:\mly\kf_dist;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
云服务器部署前端代码,带有路径的url直接访问,404
修改Nginx配置,当页面找不到的情况下,重定向会首页。
# 之前
error_page 497 https://$host$request_uri;
# 修改为如下
error_page 404 /index.html;
评论区