

免费资源网 – https://freexyz.cn/
步骤
将准备好的静态资源文件放在指定文件夹 更改nginx的配置文件:nginx.conf 启动nginx服务:start nginx (一定要切换到nginx的目录下) 在浏览器中检查是否发布成功实际操作
把所发布的静态网页放入指定文件夹:
更改nginx的配置文件:
nginx.conf配置内容如下:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { gzip on; #静态文件 server { listen 8080; server_name localhost; location / { root D:/resources/statichtmls; } } #html文件 server { listen 8080; server_name 127.0.0.1 localhost; location / { root D:/resources/statichtmls; index index.html index.htm; } } }启动nginx:
检查是否发布成功
如若未成功,请检查端口号或其他配置,及静态文件是否正确
关闭nginx
测试完毕后,如若不使用,记得关闭nginx
再次进入已经显示进不去了,证明nginx关闭了
免费资源网 – https://freexyz.cn/
© 版权声明
THE END
暂无评论内容