Skip to content

Instantly share code, notes, and snippets.

@mtrl
Created September 9, 2011 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtrl/1205947 to your computer and use it in GitHub Desktop.
Save mtrl/1205947 to your computer and use it in GitHub Desktop.
Magento nginx conf
server {
listen 81;
server_name
[www.example.com]
[example.com]
;
rewrite ^(.*) https://[www.example.com]$1 permanent;
}
server {
listen 443 ssl;
server_name
[example.com]
[www.example.com]
;
ssl_certificate ssl/[example.com].pem;
ssl_certificate_key ssl/[example.com].key;
keepalive_timeout 60;
root /var/www/[example.com];
index index.html index.php;
expires 30d;
location / {
try_files $uri $uri/ @magento;
}
# disable dangerous locations
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location @magento {
rewrite / /index.php;
}
location ~ \.php/ {
rewrite ^(.*\.php)/ $1 last;
}
location ~ \.php$ {
if (!-e $request_filename) {
## Catch 404s that try_files misses
rewrite / /index.php last;
}
expires -1;
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration
fastcgi_param MAGE_RUN_TYPE store;
include conf/php-cgi.conf;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment