1 - Download WinSW
2 - Copy same file(WinSW.NET2.exe) for two directories: c:\svc\php\phpsvc.exe
and c:\svc\nginx\nginxsvc.exe
3 - Download and extract PHP(Non Thread Safe) to c:\php
4 - Download and extract Nginx for Windows to c:\nginx
5 - Replace c:\nginx\conf\nginx.conf
with nginx.conf
of this gist.
6 - Run cmd
with Administrator Privileges(this is very important).
7 - cd c:\svc\nginx
7.1 - nginxsvc.exe install
8 - cd c:\svc\php
8.1 - phpsvc.exe install
9 - Open services.msc
and run PHP and Nginx.
10 - All done.
Last active
May 12, 2025 07:39
-
-
Save sistematico/d84e04bbd7eec65dc35a76b634726887 to your computer and use it in GitHub Desktop.
Windows 10 + Nginx + PHP FastCGI Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
root html; | |
index index.php index.html index.htm; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9123; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<service> | |
<id>nginxsvc</id> | |
<name>Nginx</name> | |
<description>Nginx Web Server service.</description> | |
<executable>c:\nginx\nginx.exe</executable> | |
<logpath>c:\nginx\logs\</logpath> | |
<logmode>roll</logmode> | |
<depend>phpsvc</depend> | |
<startargument>-p</startargument> | |
<startargument>c:\nginx</startargument> | |
<stopexecutable>c:\nginx\nginx.exe</stopexecutable> | |
<stopargument>-p</stopargument> | |
<stopargument>c:\nginx</stopargument> | |
<stopargument>-s</stopargument> | |
<stopargument>stop</stopargument> | |
</service> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<service> | |
<id>phpsvc</id> | |
<name>PHP</name> | |
<description>PHP-FCGI service.</description> | |
<executable>c:\php\php-cgi.exe</executable> | |
<logpath>c:\php\logs\</logpath> | |
<logmode>roll</logmode> | |
<depend></depend> | |
<startargument>-b</startargument> | |
<startargument>127.0.0.1:9123</startargument> | |
<startargument>-c</startargument> | |
<startargument>C:\php\php.ini</startargument> | |
</service> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment