box-o-sand/PracticingPhp/web-cake/nginx.conf.in

78 lines
1.9 KiB
Nginx Configuration File
Raw Normal View History

worker_processes 1;
error_log __ROOT__/error.log;
2011-01-03 15:04:15 +00:00
# error_log error.log;
pid __ROOT__/server.pid;
daemon off;
events {
worker_connections 4096;
}
http {
include __ROOT__/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
2011-01-03 15:04:15 +00:00
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
autoindex on;
server {
listen __HTTP_PORT__;
2011-01-03 15:04:15 +00:00
server_name www.__HTTP_HOST__;
access_log __ROOT__/access.log main;
2011-01-03 15:04:15 +00:00
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;
2011-01-03 15:04:15 +00:00
# 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__;
# }
2011-01-03 15:04:15 +00:00
location / {
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;
}
2011-01-03 15:04:15 +00:00
location ~ .*\.php[345]?$ {
include __ROOT__/fastcgi_params;
fastcgi_pass 127.0.0.1:__PHP_FCGI_PORT__;
2011-01-03 15:04:15 +00:00
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME __ROOT__/html/app/webroot$fastcgi_script_name;
}
2011-01-03 15:04:15 +00:00
}
2011-01-03 15:04:15 +00:00
}
# vim:filetype=nginx