Skip to content

Instantly share code, notes, and snippets.

@floodedcodeboy
Created June 6, 2015 23:17
Show Gist options
  • Save floodedcodeboy/b952e51fc9db10e6a465 to your computer and use it in GitHub Desktop.
Save floodedcodeboy/b952e51fc9db10e6a465 to your computer and use it in GitHub Desktop.
nginx magento subfolder config
## lifted shamelessly from http://stackoverflow.com/questions/19142004/nginx-magento-in-subfolder
server {
listen 80;
listen 443;
server_name www.domain.de domain.de *.domain.de;
root /var/www/domain.de/www.domain.de/htdocs;
index index.php;
access_log /var/log/nginx/domain_access.log;
error_log /var/log/nginx/domain_error.log;
error_page 403 /403.php;
error_page 404 /404.php;
error_page 500 /500.php;
error_page 501 /500.php;
error_page 502 /500.php;
error_page 503 /500.php;
location ~* \.(js|css|jpg|jpeg|gif|png|ico|swf)$ {
if (-f $request_filename) {
expires 30d;
add_header Cache-Control "public";
break;
}
}
#Temp-Dateien blocken
location ~* \.(bak|cache|csv|git|old|php~|spool|svn|swp|temp|tmp)$ {
deny all;
}
#Sonstige Dateien blocken
location ~* \.(1st|386|app|ani|asm|bat|bin|cfg|cmd|cnf|com|cpl|dbs|dll|drv|exe|inc|sh|lnk|reg|scr|sys|vxd)$ {
deny all;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location /shop {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
if ($uri ~ "^/index.php/admin.*$"){
rewrite ^/index.php/admin(.*) /admin$1 redirect;
}
}
location ~ ^/shop/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
location /shop/var/export/ { internal; }
location @handler { rewrite / /shop/index.php; }
location ~ ^/(gpack|img|tmp/map)/ {
allow all;
}
location ~ .*\.php?$ {
fastcgi_pass unix:/var/run/domain.de.sock;
fastcgi_index index.php;
include conf/fastcgi.conf;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment