Win 2008 r2 安装Nginx

  1. 先去官网下载最新稳定版本的Nginx: http://nginx.org/en/download.html
  2. 先去官网下载最新版本的Windows Service Wrapper: http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/
  3. 解压Nginx压缩包到C盘目录,并重命名为nginx
  4. 将winsw-2.3.0-bin.exe解压到nginx目录下,并重命名为nginx-service.exe
  5. 在nginx根目录创建nginx-service.xml文件
    <?xml version="1.0" encoding="UTF-8" ?>
    <service>
    <id>Nginx</id>
    <name>Nginx</name>
    <description>本服务用于加载Nginx服务,请确保开机启动。</description>
    <logpath>C:\nginx\logs</logpath>
    <executable>nginx.exe</executable>
    <stopexecutable>nginx.exe</stopexecutable>
    <stopargument>-s</stopargument> 
    <stopargument>stop</stopargument>
    <logmode>rotate</logmode>
    </service>
  6. 安装Nginx系统服务
    C:\nginx\nginx-service.exe install
  7. 卸载Nginx系统服务
    C:\nginx\nginx-service.exe uninstall
  8. 启动Nginx服务
    net start nginx
  9. 关闭Nginx服务
    net stop nginx
  10. 配置文件在
    C:\nginx\conf\nginx.conf
  11. 记得打开防火墙
    防火墙中直接允许 C:\nginx\nginx.exe
0%