Nginx常用配置及命令记录

常用命令cd e:\Nginx cd nginx-1.16.1 start nginx tasklist /fi "imagename eq nginx.exe" //查看进程 nginx -t -c ./conf/nginx.conf //检查配置文件 nginx -s relo...

2021年11月28日
175字
7 阅读

常用命令

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;

文章评论区

欢迎留言交流

未登录,请先注册或登录后发表评论。

Leave comment