Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Last active August 29, 2015 14:00
Show Gist options
  • Save bdunogier/11252778 to your computer and use it in GitHub Desktop.
Save bdunogier/11252778 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name php55-vm.ezpublish5 php55-vm.ezpublish5.admin;
root /home/bertrand/ezpublish5/app/web;
access_log /home/bertrand/ezpublish5/app/logs/httpd-access.log;
error_log /home/bertrand/ezpublish5/app/logs/httpd-error.log debug;
disable_symlinks off;
location = /favicon.ico {
log_not_found off;
access_log off;
}
fastcgi_index index.php;
include "ez.d/rewrite.conf";
location ~ ^/(index|index_rest)\.php(/|$) {
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
include "ez.d/fpm_params.conf";
fastcgi_pass unix:/var/run/php5-fpm-ezpublish5.sock;
}
location /_internal {
return 403;
}
}
set $fc_script_name "index.php";
if ( $uri ~ "^/(.*\.php)" ) {
set $fc_script_name $1;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fc_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/$fc_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
rewrite_log off;
# Some custom rewrite
rewrite "^/api/[^/]+/v1" "/index_rest.php" break;
rewrite "^tags/treemenu/?" "index_treemenu_tags.php" break;
rewrite "^index_treemenu_tags\.php" "/index_treemenu_tags.php" break;
#rewrite .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Api rest v1 rewrite "^/api/[^/]+/v1/" "/index_rest.php" break;
#rewrite "^/var/([^/]+/)?storage/images(-versioned)?/(.*)" "/index_cluster.php" break;
#rewrite "^/var/([^/]+/)?cache/(texttoimage|public)/(.*)" "/index_cluster.php" break;
rewrite "^/var/([^/]+/)?storage/images(-versioned)?/(.*)" "/var/$1storage/images$2/$3" break;
rewrite "^/var/([^/]+/)?cache/(texttoimage|public)/(.*)" "/var/$1cache/$2/$3" break;
rewrite "^/design/([^/]+)/(stylesheets|images|javascript|fonts)/(.*)" "/design/$1/$2/$3" break;
rewrite "^/share/icons/(.*)" "/share/icons/$1" break;
rewrite "^/extension/([^/]+)/design/([^/]+)/(stylesheets|flash|images|lib|javascripts?)/(.*)" "/extension/$1/design/$2/$3/$4" break;
rewrite "^/packages/styles/(.+)/(stylesheets|images|javascript)/([^/]+)/(.*)" "/packages/styles/$1/$2/$3/$4" break;
rewrite "^/packages/styles/(.+)/thumbnail/(.*)" "/packages/styles/$1/thumbnail/$2" break;
rewrite "^/var/storage/packages/(.*)" "/var/storage/packages/$1" break;
# Assetic rules for eZ Publish 5.1 and higher:
rewrite "^/css/(.*)\.css" "/css/$1.css" break;
rewrite "^/js/(.*)\.js" "/js/$1.js" break;
rewrite "^/favicon\.ico" "/favicon.ico" break;
#rewrite "^/favicon\.ico" "/design/standard/images/favicon.ico" break;
rewrite "^/design/standard/images/favicon\.ico" "/design/standard/images/favicon.ico" break;
rewrite "^/robots\.txt" "/robots.txt" break;
rewrite "^/w3c/p3p\.xml" "/w3c/p3p.xml" break;
rewrite "^/bundles/(.*)" "/bundles/$1" break;
rewrite "^/cgi-bin" "/cgi-bin" break;
rewrite "^(.*)$" "/index.php?$1" last;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment