惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
V
V2EX
IT之家
IT之家
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
D
Docker
S
Secure Thoughts
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
博客园_首页
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
I
InfoQ
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
T
Troy Hunt's Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
T
Tor Project blog
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
G
Google Developers Blog

博客园 - 丁少华

React UI 库推荐 Loop Engineering Vue 3 UI 组件库 Neon白嫖免费pgsql 域名利用cloudflare免费图床 nginx反代CloudflarePages提示502 vite使用shadcn vite使用biome winserver2022安装不上软件 mac已损坏无法打开 代码高亮 命令运行器之task 命令运行器之just windows开启wsl 白嫖Redis 白嫖MongoDB vercel无服务函数 无服务器函数完全指南 在线 mock 方案 解释型语言和编译型语言 何时该使用monorepo monorepo前端专属吗 Cursor锁区问题 CentOS9上Let’s Encrypt自动续签 Windows给文件夹别名 ai 常识 nestjs逆向工程Prisma与DTO nestjs的orm之Prisma
Window下Nginx
丁少华 · 2026-03-17 · via 博客园 - 丁少华

Windows系统下Nginx的启动、停止与配置管理指南

在Windows系统中,Nginx的启动与管理涉及命令行操作、配置验证及进程监控等关键步骤。本文将系统梳理Nginx在Windows环境下的核心操作流程,帮助用户快速掌握服务管理方法。

启动Nginx服务

命令行启动

  1. 后台启动(推荐):

    start nginx
    

    该命令会启动Nginx服务并隐藏命令行窗口,适合长期运行场景。

  2. 前台启动

    nginx.exe
    

    直接运行可执行文件会保留命令行窗口,便于观察启动日志。

双击启动

直接双击解压后的nginx.exe文件,若黑色弹窗一闪而过则表示启动成功。

验证服务状态

浏览器验证

  • 打开浏览器访问 http://localhost,若显示Nginx欢迎页面则服务正常运行。

命令行检查

tasklist /fi "imagename eq nginx.exe"

输出结果中包含nginx.exe进程即表示服务已启动。

常用管理命令

操作类型 命令示例 说明
停止服务 nginx.exe -s stop 快速终止进程
优雅停止 nginx.exe -s quit 等待当前请求处理完毕
重载配置 nginx.exe -s reload 无需重启应用配置变更
语法检查 nginx.exe -t 验证配置文件正确性
关闭所有nginx taskkill /f /im nginx.exe

关键注意事项

路径配置

执行命令前需确保:
1. 命令行已切换至Nginx安装目录(如cd C:\nginx
2. 或使用绝对路径(如C:\nginx\nginx.exe

端口冲突处理

当80端口被占用时:
1. 停止冲突服务(如IIS/Apache)
2. 修改nginx.conf中的listen参数:

server { listen 8080; # 改为其他可用端口 ... }

开机自启配置

通过winsw工具将Nginx注册为Windows服务:
1. 下载winsw.exe并重命名为nginx-service.exe
2. 创建XML配置文件nginx-service.xml

html <service> <id>nginx</id> <name>Nginx Web Server</name> <description>High performance web server</description> <executable>C:\nginx\nginx.exe</executable> <logmode>rotate</logmode> </service>

3. 执行注册命令:

nginx-service.exe install

完整操作示例

  1. 解压安装:将Nginx压缩包解压至C:\nginx目录

  2. 启动服务

    cd C:\nginx
    start nginx
    
  3. 验证运行

    tasklist /fi "imagename eq nginx.exe"
    
  4. 停止服务(维护时):

    nginx.exe -s quit