Nginxサービス登録Windowsサービス

Nginxをインストールする
nginx for windows(http://nginx.org/download/nginx-1.10.0.zip)をダウンロードして、目的の場所に解凍します(D:\ xampp \ nginx)
NginxをWindowsサービスとして設定する
「Windows Service Wrapper」ガジェット、プロジェクトアドレスを使用する必要があります:https : //github.com/kohsuke/winsw
 

winsw-1.18-bin.exe

58KB
ツールをダウンロードしたら、それをNginxインストールディレクトリに配置し、名前をnginx-service.exeに変更して、構成ファイルnginx-service.xmlを作成します(名前はツール名と同じにする必要があります)。
nginx-service.exe.configを作成します(NET 4.0ランタイムをサポートするため、デフォルトではNET 2.0ランタイムのみがサポートされています)
ファイル構造は次のとおりです。
nginx-service.xmlの内容は次のとおりです。
 
<service> <id> nginx </ id> <name> Nginx Service </ name> <description> High Performance Nginx Service </ description> <logpath> D:\ xampp \ nginx \ logs </ logpath> <log mode = "roll-by-size"> <sizeThreshold> 10240 </ sizeThreshold> <keepFiles> 8 </ keepFiles> </ log> <executable> D:\ xampp \ nginx \ nginx.exe </ executable> <startarguments> -p D:\ xampp \ nginx </ startarguments> <stopexecutable> D:\ xampp \ nginx \ nginx.exe </ stopexecutable> <stoparguments> -p D:\ xampp \ nginx -s stop </ stoparguments> </ service>
 
nginx-service.exe.configの内容は次のとおりです。
 
<configuration> <startup> <supportedRuntime version = "v2.0.50727" /> <supportedRuntime version = "v4.0" /> </ startup> <runtime> <generatePublisherEvidence enabled = "false" /> </ runtime> </構成>
 
cmdで次のコマンドを実行して、Windowsサービスをインストールします。
D:\ xampp \ nginx \ nginx-service.exe install
次に、Windowsサービスパネルでサービスを開始できます
ブラウザで通常どおりアクセスできます
 

おすすめ

転載: www.cnblogs.com/Jason2018/p/12760854.html
おすすめ