将nginx安装为windows服务

将nginx安装为windows服务

nginx 常用操作命令

start nginx

tasklist /fi "imagename eq nginx.exe"

nginx -s stop	fast shutdown
nginx -s quit	graceful shutdown
nginx -s reload	changing configuration,starting new worker processes with a new configuration,graceful shutdown of old worker processes
nginx -s reopen	re-opening log files

nginx 安装为windows服务

  • 下载Windows Service Wrapper工具,选择合适版本下载,该工具可设置nginx为windows服务。

  • 下载后把下载的winsw-2.1.2-bin.exe 文件放在Nginx安装目录(C:\Program Files\Nginx),并修改名称为nginx-service.exe,然后分别创建nginx-service.exe.config,nginx-service.xml文件,把这两个文件放在Nginx安装目录下。

  • nginx-service.exe.config内容如下:


  
    
    
  
  
     
  

  • nginx-service.xml内容如下(根据实际情况对路径进行调整):

  nginx
  Nginx Service
  High Performance Nginx Service
  C:\Program Files\Nginx\logs
  
    10240
    8
  
  C:\Program Files\Nginx\nginx.exe
  -p C:\Program Files\Nginx
  C:\Program Files\Nginx\nginx.exe
  -p C:\Program Files\Nginx -s stop

安装nginx服务 nginx-service.exe install

删除nginx服务 sc delete 服务名

你可能感兴趣的:(windows,windows)