Nginx开发笔记(年代有点久远,归档)

Nginx开发笔记
 
Windows平台:
在win11平台出现直接双击nginx.exe后启动后再nginx -s stop/quit均无法真正退出nginx进程。
用管理员权限打开cmd,输入下面命令调试:
tasklist /fi "IMAGENAME eq nginx.exe" #查看nginx进程
0
taskkill /f /pid 1140 #杀死nginx进程
0
 
正确使用nginx方式:
以管理员权限打开cmd,在cmd中切换到nginx目录下,使用下面的命令使用nginx
start nginx #启动nginx
nginx -s reload #重新加载配置文件
0
其它命令类似操作
 
Demo: 配置2个文件服务器:
server { listen 8080; # server_name localhost; root C:/data; location / { # autoindex on; #开启索引功能 # autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb) # autoindex_localtime on; # 显示本机时间而非 GMT 时间 # charset utf-8; # 避免中文乱码 # root html; # index index.html index.htm; } } server { listen 8000; # server_name localhost; root C:/Develop/codespace/cesium-samples; location / { # charset utf-8; # 避免中文乱码 # root html; # index index.html index.htm; } }
参考:https://blog.csdn.net/weixin_40908748/article/details/110140072
 
---Nginx配置GIS瓦片请求404时默认请求404.png
server { listen 9090; # server_name localhost; root C:/data; location / { autoindex on; #开启索引功能 autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb) autoindex_localtime on; # 显示本机时间而非 GMT 时间 charset utf-8; # 避免中文乱码 # root html; # index index.html index.htm; if ( !-f $request_filename ) { # 文件不存在 rewrite (.*) /gis/tiles/404.png; } } }
 
posted on 2026-09-13 21:45  DavidXu2014  阅读(3)  评论(0)    收藏  举报