Skip to content

Instantly share code, notes, and snippets.

@mariano-aguero
Last active September 22, 2015 19:01
Show Gist options
  • Save mariano-aguero/a0a49bb9c275da3b3dca to your computer and use it in GitHub Desktop.
Save mariano-aguero/a0a49bb9c275da3b3dca to your computer and use it in GitHub Desktop.
Nginx Configuration for elgg
# Elgg Nginx configuration. Customize and put into /etc/nginx/sites-enabled
server {
listen 80;
server_name example.org;
# Server root, replace it with your elgg installation location
root /srv/example.org;
index index.php index.html index.htm;
# Server logs, replace it with your project names
error_log /var/log/nginx/example_error.log;
access_log /var/log/nginx/example_access.log;
fastcgi_intercept_errors on;
error_page 500 501 502 504 505 506 507 508 509 510 511 520 521 522 523 524 598 599 @errors_example;
location @errors_example {
root /srv/example.org/errors;
rewrite ^(.*)$ /5XX.html break;
}
# Test errors
location /test_error {
return 500;
}
location ~ (^\.|/\.) {
return 403;
}
location /cache {
rewrite ^/cache\/(.*)$ /engine/handlers/cache_handler.php?request=$1&$query_string;
}
location /export {
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;
}
location = /rewrite.php {
rewrite ^(.*)$ /install.php;
}
location / {
try_files $uri $uri/ /index.php?__elgg_uri=$uri&$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment