nginx 配置服务启动的教程详解
1. 先去官网下载nginx 安装到本地
2. 下载Windows Service Wrapper (WinSW.NET4.exe (64) , WinSW.NET2.exe(86)) 根据自己系统去下载相应的
3. (1)把WinSW.NET4.exe 放到nginx 文件名称改成自己想要的
(2)创建一个.xml的文件,需要跟WinSW.NET4.exe 这个改成自己的文件名字相同

4. 打开.xml 添加下面一段(把路径设置自己nginx路径)
<service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <env name="path" value="D:/Software/nginx/nginxt"/> --nginx 路径 <executable>D:/Software/nginx/nginxt/nginx.exe</executable> <arguments>-p D:/Software/nginx/nginxt</arguments> <logpath>D:/Software/nginx/nginxt/logs/</logpath> <logmode>roll</logmode> </service>
5. 打开cmd 通过命令行 切换自己的nginx文件目录下面 或者直接在nginx 输入cmd

运行命令:
nginx-service.exe install 添加服务 nginx-service.exe uninstall 删除服务
5.1 如果出现下面问题:说明没有访问权限,请找到命令指示器,选择用管理员身份运行,使用命令切换nginx 目录下d;
命令:
d: cd D:\Software\nginx\nginxt

5.2 如果是下面:(说明安装成功)

然后打开服务管理(服务还没有启动,需要把服务启动起来)

5.3 然后找到(window10)

打开文件:添加127.0.0.1 www.xxx.com (自定义)

6. 测试(输入访问地址) 提示:如果访问不了,先看查服务有没有启动,然后在排除其他问题
