Created
May 16, 2014 08:33
-
-
Save pedroresende/9775b389c0d0cf4a5ff7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name ezp5 admin.ezp5; | |
index index.php; | |
root /var/www/html/ezpublish5/web; | |
autoindex on; | |
access_log /var/log/nginx/ezp5.log; | |
error_log /var/log/nginx/ezp5_error.log notice; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
# With php5-cgi alone: | |
#fastcgi_pass 127.0.0.1:9000; | |
# With php5-fpm: | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# Environment. | |
# Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration | |
# Defaults to "prod" if omitted | |
fastcgi_param ENVIRONMENT dev; | |
# Whether to use Symfony's ApcClassLoader. | |
# Possible values: 0 or 1 | |
# Defaults to 0 if omitted | |
#fastcgi_param USE_APC_CLASSLOADER 0; | |
# Prefix used when USE_APC_CLASSLOADER is set to 1. | |
# Use a unique prefix in order to prevent cache key conflicts | |
# with other applications also using APC. | |
# Defaults to "ezpublish" if omitted | |
#fastcgi_param APC_CLASSLOADER_PREFIX ezpublish; | |
# Whether to use debugging. | |
# Possible values: 0 or 1 | |
# Defaults to 0 if omitted, unless ENVIRONMENT is set to: "dev" | |
#fastcgi_param USE_DEBUGGING 0; | |
# Whether to use Symfony's HTTP Caching. | |
# Disable it if you are using an external reverse proxy (e.g. Varnish) | |
# Possible values: 0 or 1 | |
# Defaults to 1 if omitted, unless ENVIRONMENT is set to: "dev" | |
#fastcgi_param USE_HTTP_CACHE 1; | |
# Defines the proxies to trust. | |
# Separate entries by a comma | |
# Example: "proxy1.example.com,proxy2.example.org" | |
# By default, no trusted proxies are set | |
#fastcgi_param TRUSTED_PROXIES 127.0.0.1; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
location /_internal { | |
return 403; | |
} | |
location / { | |
try_files $uri @prerender | |
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; | |
# Give direct access to robots.txt for use by crawlers (Google, | |
# Bing, Spammers..) | |
rewrite "^/robots\.txt" "/robots.txt" break; | |
rewrite "^/w3c/p3p\.xml" "/w3c/p3p.xml" break; | |
# Following rule is needed to correctly display assets from eZ Publish5 / Symfony bundles | |
#rewrite "^/bundles/.*" "/bundles/$1" break; | |
rewrite "^/bundles/(.*)" "/bundles/$1" break; | |
rewrite "^(.*)$" "/index.php?$1" last; | |
} | |
location @prerender { | |
if ($args ~ "_fragment?=(.*)") { | |
rewrite ^ /${uri}; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment