nginx作为反向代理访问静态资源报404错以及nginx: [error] OpenEvent("Global\ngx_reload_5744") failed (2: The sys

系统是win10

相关.conf的配置如下,感觉没问题,但nginx一直报404

server{
  listen 80;
  autoindex off;
  server_name wanghz.com;
  access_log d:\access.log combined;
  index index.html index.htm index.jsp index.php;
  #error_page 404 /404.html;
  if ( $query_string ~* ".*[\;'\<\>].*" ){
   return 404;
}

location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* {
   deny all;
}
  location / {
    root D:\FTPServer\ftpfile\img;
    add_header Access-control_Allow_Origin *;
}
}

后来发现在任务管理器中结束nginx运行,并且双击nginx.exe重启(一定要有这一步),再在命令行运行nginx.exe -t 和nginx.exe -s reload才不会报错,然后在浏览器地址栏输入就可以正常访问了

你可能感兴趣的:(项目经验笔记)