1. 程式人生 > >nginx作為反向代理訪問靜態資源報404錯以及nginx: [error] OpenEvent("Global\ngx_reload_5744") failed (2: The sys

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才不會報錯,然後在瀏覽器位址列輸入就可以正常訪問了