Skip to content

Instantly share code, notes, and snippets.

@zmax
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save zmax/bf2d61761bb1c710ae67 to your computer and use it in GitHub Desktop.

Select an option

Save zmax/bf2d61761bb1c710ae67 to your computer and use it in GitHub Desktop.
craft cms nginx conf
server {
listen 80;
server_name domain.com;
root /var/www/domain.com/public;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript image/svg+xml text/xml text/css;
gzip_vary on;
# end gzip configuration
# Increase max upload size
client_max_body_size 100m;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/domain.com-error.log error;
error_page 404 /index.php;
# Start Localization Rewrites
location /es/ {
try_files $uri $uri/ @esrewrites;
}
location @esrewrites {
rewrite ^/es/(.*)$ /es/index.php?p=$1? last;
}
location @plrewrites {
rewrite ^/pl/(.*)$ /pl/index.php?p=$1? last;
}
location /pl/ {
try_files $uri $uri/ @plrewrites;
}
location /ro/ {
try_files $uri $uri/ @rorewrites;
}
location @rorewrites {
rewrite ^/ro/(.*)$ /ro/index.php?p=$1? last;
}
# End Localization Rewrites
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment