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 这个改成自己的文件名字相同

nginx 配置服务启动的教程详解 nginx 第1张

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 配置服务启动的教程详解 nginx 第2张

 运行命令:

  nginx-service.exe install 添加服务  nginx-service.exe uninstall 删除服务

5.1    如果出现下面问题:说明没有访问权限,请找到命令指示器,选择用管理员身份运行,使用命令切换nginx 目录下d;

        命令:

  d:   cd D:Softwarenginxnginxt

nginx 配置服务启动的教程详解 nginx 第3张

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

nginx 配置服务启动的教程详解 nginx 第4张

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

nginx 配置服务启动的教程详解 nginx 第5张

5.3     然后找到(window10)

 nginx 配置服务启动的教程详解 nginx 第6张

       打开文件:添加127.0.0.1    (自定义)

 nginx 配置服务启动的教程详解 nginx 第7张

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

        nginx 配置服务启动的教程详解 nginx 第8张    

总结

以上所述是小编给大家介绍的nginx 配置服务启动的教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

参与评论