breaking the nginx conf for cake

cat-town
Dan Buch 14 years ago
parent 8326524a99
commit b781c8ec54

@ -1,6 +1,7 @@
ROOT ?= $(PWD)
HTTP_PORT ?= 49438
HTTP_HOST ?= localhost
PHP_FCGI_PORT ?= 49439
@ -13,14 +14,19 @@ serve-php: php.ini
nginx.conf: nginx.conf.in
chmod 644 $@ ;
cat $< | \
sed -e 's@__ROOT__@$(ROOT)@g' \
-e 's@__HTTP_PORT__@$(HTTP_PORT)@g' \
-e 's@__PHP_FCGI_PORT__@$(PHP_FCGI_PORT)@g' > $@
-e 's@__HTTP_HOST__@$(HTTP_HOST)@g' \
-e 's@__PHP_FCGI_PORT__@$(PHP_FCGI_PORT)@g' > $@ ;
chmod 444 $@
php.ini: php.ini.in
cat $< | sed -e 's@__ROOT__@$(ROOT)@g' > $@
chmod 644 $@ ;
cat $< | sed -e 's@__ROOT__@$(ROOT)@g' > $@ ;
chmod 444 $@
.PHONY: serve

@ -1,5 +1,6 @@
worker_processes 1;
error_log __ROOT__/error.log;
# error_log error.log;
pid __ROOT__/server.pid;
daemon off;
@ -22,33 +23,55 @@ http {
server {
listen __HTTP_PORT__;
server_name localhost;
access_log access.log main;
server_name www.__HTTP_HOST__;
rewrite ^(.*) http://__HTTP_HOST__:__HTTP_PORT__$1 permanent;
}
server {
listen __HTTP_PORT__;
server_name __HTTP_HOST__;
access_log __ROOT__/access.log main;
# access_log access.log main;
root __ROOT__/html;
# location / {
# index index.html index.txt index.php;
# rewrite (.*) /app/webroot$1 last;
# rewrite ^$ /app/webroot last;
# }
#
# location /app/webroot {
# index index.html index.txt index.php;
# }
#
# location ~ \.php$ {
# include __ROOT__/fastcgi_params;
# fastcgi_pass 127.0.0.1:__PHP_FCGI_PORT__;
# }
location / {
index index.html index.txt index.php;
rewrite (.*) /app/webroot$1 last;
rewrite ^$ /app/webroot last;
root __ROOT__/html/app/webroot/;
index index.php index.html index.htm;
if (-f $request_filename) {
break;
}
location /app/webroot {
index index.html index.txt index.php;
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
include fastcgi_params;
location ~ .*\.php[345]?$ {
include __ROOT__/fastcgi_params;
fastcgi_pass 127.0.0.1:__PHP_FCGI_PORT__;
}
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME __ROOT__/html/app/webroot$fastcgi_script_name;
}
}
# <IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteRule ^$ app/webroot/ [L]
# RewriteRule (.*) app/webroot/$1 [L]
# </IfModule>
}
# vim:filetype=nginx
Loading…
Cancel
Save