Skip to content

Instantly share code, notes, and snippets.

@IamSwap
Created May 3, 2016 18:46
Show Gist options
  • Save IamSwap/8b5699d45a35275c05bc128c6ec4ad26 to your computer and use it in GitHub Desktop.
Save IamSwap/8b5699d45a35275c05bc128c6ec4ad26 to your computer and use it in GitHub Desktop.
Nginx configuration for Magento 1.7, 1.8 & 1.91
server {
listen 80;
server_name example.come;
root /var/www/example.com;
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
## These locations would be hidden by .htaccess normally
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; }
## Disable .htaccess and other hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location @handler {
rewrite / /index.php;
}
location ~ \.php/ {
rewrite ^(.*\.php)/ $1 last;
}
location ~ \.php$ {
if (!-e $request_filename) {
rewrite / /index.php last;
}
expires off;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
include snippets/fastcgi-php.conf;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment