- Extract the nginx to a location. example
C:\nginx
- Extract the PHP for Windows into nginx folder. example
C:\nginx\php
- Configure PHP in nginx:
- Remove nginx.conf
- add the below nginx.conf :
location ~ .php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME C:/nginx/html/$fastcgi_script_name; include fastcgi_params; }
- To start the nginx server and php:
@echo OFF start C:\nginx\nginx.exe start C:\nginx\php\php-cgi.exe -b 127.0.0.1:9000 -c C:\nginx\php\php.ini ping 127.0.0.1 -n 1>NUL echo Starting nginx echo . echo .. echo ... ping 127.0.0.1 >NUL exit
- To stop nginx and php:
@echo OFF taskkill /f /IM nginx.exe taskkill /f /IM php-cgi.exe exit
- Check the server at 127.0.0.1 or localhost
Last active
December 21, 2024 15:11
-
-
Save brosahay/917d23fea77801b0a5dc6b9249fc725b to your computer and use it in GitHub Desktop.
Setup Nginx Server with PHP on windows
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much