breaking the nginx conf for cake

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

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

@ -1,5 +1,6 @@
worker_processes 1; worker_processes 1;
error_log __ROOT__/error.log; error_log __ROOT__/error.log;
# error_log error.log;
pid __ROOT__/server.pid; pid __ROOT__/server.pid;
daemon off; daemon off;
@ -14,41 +15,63 @@ http {
default_type application/octet-stream; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status ' log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" ' '"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
autoindex on; autoindex on;
server { server {
listen __HTTP_PORT__; listen __HTTP_PORT__;
server_name localhost; server_name www.__HTTP_HOST__;
access_log access.log main; 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; root __ROOT__/html;
location / { # location / {
index index.html index.txt index.php; # index index.html index.txt index.php;
rewrite (.*) /app/webroot$1 last; # rewrite (.*) /app/webroot$1 last;
rewrite ^$ /app/webroot 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 /app/webroot { location / {
index index.html index.txt index.php; root __ROOT__/html/app/webroot/;
index index.php index.html index.htm;
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;
} }
location ~ \.php$ { location ~ .*\.php[345]?$ {
include fastcgi_params; include __ROOT__/fastcgi_params;
fastcgi_pass 127.0.0.1:__PHP_FCGI_PORT__; 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 # vim:filetype=nginx
Loading…
Cancel
Save