Windows Service Nginx

| 分类 nginx  | 标签 nginx 

Nginx Windows Service

Copy Files To Local

nginx-1.15.8.zip nssm-2.24.zip

Unzip Files

unzip nginx-1.15.8.zip and nssm-2.24.zip

Config nginx

%nginx_home%\conf\nginx.conf

Config port

Port 12345

Config File Folder


location /bw {
            alias   C:\\tibco\\tra\\domain\\WynnQAWP\\application\\logs;
			autoindex on;
            index  index.html index.htm;
}
location /offline {
            alias   C:\\var\\log\\wynn;
			autoindex on;
            index  index.html index.htm;
 }

Example

server {
        listen       12345;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
  location / {
            root   html;
            autoindex on;
            index  index.html index.htm;
        }
        location /bw {
            location ~.log {
				add_header Content-Type text/plain;
			}
            alias   C:\\tibco\\tra\\domain\\WynnQAWP\\application\\logs;
			autoindex on;
            index  index.html index.htm;
        }
		location /offline {
            alias   C:\\var\\log\\wynn;
			autoindex on;
            index  index.html index.htm;
        }

Install Nginx as Windows Service

    1. Go to ommand line, run “nssm.exe install nginx”
    1. In NSSM gui do the following:
    1. On the application tab: set path to C:\mysoftware\nginx-1.15.8\nginx.exe, set startup directory to C:\mysoftware\nginx-1.15.8
    1. On the I/O tab type “start nginx” on the Input slow. Optionally set C:\mysoftware\nginx-1.15.8\logs\service.out.log and C:\mysoftware\nginx-1.15.8\logs\service.err.log in the output and error slots
    1. Click “install service”. Go to services, start “nginx”
    1. Open http://localhost:12345 in chrome

上一篇     下一篇