佛山企业网站建设公司,包头网站建设哪家好,有什么专门搜试卷做的网站,win10必做的优化描述#xff1a;把一个项目或者数据发布出来#xff0c;通过http的形式访问#xff0c;比如发布一个js文件#xff0c;用http://localhost:6060/data/jquery/jquery.min.js访问。 步骤#xff1a;配置nginx.conf文件#xff0c;nginx.conf位于conf目录下#xff0c;在se… 描述把一个项目或者数据发布出来通过http的形式访问比如发布一个js文件用http://localhost:6060/data/jquery/jquery.min.js访问。 步骤配置nginx.conf文件nginx.conf位于conf目录下在server中添加如下配置 location /data {add_header Access-Control-Allow-Origin *;add_header Access-Control-Allow-Methods GET, POST, OPTIONS;add_header Access-Control-Allow-HeadersDNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization;if ($request_method OPTIONS ) {return 204;}alias E:/YZ/serverData;} 通过此方式就把E:/YZ/serverData这个目录发布出来了可通过http://localhost:6060/data访问serverData目录里面的资源。
比如访问serverData/jquery/jquery.min.js即可通过http://localhost:6060/data/jquery/jquery.min.js方式访问到。