Skip to content

Instantly share code, notes, and snippets.

@rahilwazir
Last active May 30, 2016 19:33
Show Gist options
  • Save rahilwazir/96872155e78f6fd20ce43a10435f1b6b to your computer and use it in GitHub Desktop.
Save rahilwazir/96872155e78f6fd20ce43a10435f1b6b to your computer and use it in GitHub Desktop.
Nginx and PHP configuration on Windows
...
client_max_body_size 256M;
#gzip on;
server {
listen 80;
server_name localhost;
root html;
#charset koi8-r;
#access_log logs/host.access.log main;
# For PHP Applications using Front_controller Pattern like, Yii, Laravel and WordPress for pretty permalinks
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$args;
}
location / {
root html;
index index.html index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
...
@ECHO OFF
start .\nginx.exe
start .\php\php-cgi.exe -b 127.0.0.1:9000 -c .\php\php.ini
ping 127.0.0.1 -n 1>NUL
echo Starting nginx
echo .
echo ..
echo ...
ping 127.0.0.1 >NUL
EXIT
@ECHO OFF
taskkill /f /IM nginx.exe
taskkill /f /IM php-cgi.exe
Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment