Forums / Install & configuration / Installation on Nginx

Installation on Nginx

Author Message

Boris HUISGEN

Tuesday 20 October 2009 4:00:33 am

This is my configuration file to host ezpublish on my nginx server.

server {
 listen       80;
 server_name  ezpublish.bhuisgen.my.domain;
 root /Users/bhuisgen/Sites/ezpublish/www/html;
 index index.php;

 if (!-f $request_filename) {
    rewrite ^(.*)$ /404;
 }

 location ~ "^/[^/]*\.php$" {
    set $script "index.php";

    if ( $uri ~ "^/(.*\.php)" ) {
       set $script $1;
    }

    fastcgi_pass   unix:/opt/local/var/run/nginx/fcgi-php.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME /Users/bhuisgen/Sites/ezpublish/www/html/$script;
    include        fastcgi_params;
 }

 location / {
    rewrite "^/var/storage/(.*)$" "/var/storage/$1" break;
    rewrite "^/var/([^/]+)/storage/(.*)$" "/var/$1/storage/$2" break;
    rewrite "^/var/cache/texttoimage/(.*)$" "/var/cache/texttoimage/$1" break;
    rewrite "^/var/([^/]+)/cache/texttoimage/(.*)$" "/var/$1/cache/texttoimage/$2" break;
    rewrite "^/design/([^/]+)/(stylesheets|images|javascript)/(.*)$" "/design/$1/$2/$3" break;
    rewrite "^/share/icons/(.*)$" "/share/icons/$1" break;
    rewrite "^/extension/([^/]+)/design/([^/]+)/(stylesheets|images|javascripts|javascript|flash?)/(.*)$" "/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 "^/favicon\.ico$" "/favicon.ico" break;
    rewrite "^/robots\.txt$" "/robots.txt" break;
    rewrite "^/var/cache/debug.html(.*)$" "/var/cache/debug.html$1" break;
    rewrite "^/var/([^/]+)/cache/public/(.*)$" "/var/$1/cache/public/$2" break;
    rewrite "^/var/([^/]+)/cache/debug\.html(.*)$" "/var/$1/cache/debug.html$2" break;

    rewrite "^/content/treemenu/?$" "/index_treemenu.php" last;
    rewrite "^(.*)$" "/index.php?$1" last;
 }
}

http://blog.hbis.fr/2009/10/20/nginx-ezpublish/