# ## ### lorea.local ## # # Copyright 2011 Lorea.org # # Sample Elgg installation for a local Lorea node, using Nginx. # This is the Nginx configuration. # ## Pre-Requisites # # It assumes you have an entry in your /etc/hosts such as: # # 127.0.1.1 lorea.local # # You have PHP, Nginx and Mysql installed and configured. # # It runs on localhost, and doesn't use SSL (Refer to Nginx docs for that) server { listen 80 default; server_name lorea.local; root /var/www/lorea.local; # symlink to elgg/ index index.php index.html; # access_log /var/log/nginx/lorea.local.access.log; access_log off; error_log /var/log/nginx/lorea.local.error.log; client_max_body_size 8M; client_body_buffer_size 256K; # We treat Cache, CSS and JS files first, as these URLs are always dynamic location ~ ^/cache/ { rewrite ^/cache/(.*) /engine/handlers/cache_handler.php?request=$1 last; } location ~* ^/pg/(css|js) { rewrite ^/pg/(css|js)/(.*) /engine/handlers/page_handler.php?handler=$1&page=$2 last; rewrite ^/pg/(css|js) /engine/handlers/page_handler.php?handler=$1 last; } location ~ ^/_css/css.css { rewrite ^(/_css/css)\.css$ $1.php last; } # All other files are treated in order: existing file or dynamic PHP file location / { try_files $uri $uri/ @rewrite; } location @rewrite { rewrite ^/actions?/([A-Za-z0-9\_\-\/]+) /engine/handlers/action_handler.php?action=$1; rewrite ^/export/([A-Za-z]+)/([0-9]+)/?$ /engine/handlers/export_handler.php?view=$1&guid=$2; rewrite ^/export/([A-Za-z]+)/([0-9]+)/([A-Za-z]+)/([A-Za-z0-9\_]+)/$ /engine/handlers/export_handler.php?view=$1&guid=$2&type=$3&idname=$4; rewrite ^/pg/([A-Za-z0-9\_\-]+)/(.*) /engine/handlers/pagehandler.php?handler=$1&page=$2; rewrite ^/pg/([A-Za-z0-9\_\-]+) /engine/handlers/pagehandler.php?handler=$1; rewrite ^/services/api/([A-Za-z0-9\_\-]+)/(.*) /engine/handlers/service_handler.php?handler=$1&request=$2; rewrite ^/tag/(.+)/?$ /engine/handlers/pagehandler.php?handler=search&page=$1; rewrite ^/xml-rpc.php /engine/handlers/xml-rpc_handler.php; rewrite ^/mt-xmlrpc.cgi /engine/handlers/xml-rpc_handler.php; } location ~ \.php$ { include fastcgi_params; # Assuming php-fastcgi running on localhost port 9000 #fastcgi_pass 127.0.0.1:9000; # Assuming php-fpm is running on a local socket fastcgi_pass unix:/home/lorea/lorea_production/data/lorea.socket; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } # Do not put CSS there or it will break simplecache location ~* \.(bmp|js|gif|ico|jpg|jpeg|png)$ { expires max; # log_not_found off; } # We don't use .htaccess, but Elgg provides them. location ~ /\.ht { deny all; } }