Skip to content

Instantly share code, notes, and snippets.

@alexglue
Created February 22, 2015 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexglue/3e34957f0ede121578c0 to your computer and use it in GitHub Desktop.
Save alexglue/3e34957f0ede121578c0 to your computer and use it in GitHub Desktop.
Template for phalcon+nginx+php-fpm sites-enabled
#template for phalcon+nginx+php-fpm sites-enabled
upstream phalcon-php-fpm {
server unix:/var/run/php5-fpm.sock;
#server 127.0.0.1:9001;
}
server {
listen 80;
server_name $SERVER_NAME;
set $root_path '$PROJECT_ROOT/$PROJECT_NAME/public';
root $root_path;
access_log /var/log/nginx/$PROJECT_NAME-access.log;
error_log /var/log/nginx/$PROJECT_NAME-error.log error;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
# try_files $uri =404;
fastcgi_index /index.php;
fastcgi_pass phalcon-php-fpm;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment