Skip to content

Instantly share code, notes, and snippets.

@tinchodev
Created February 3, 2018 20:26
Show Gist options
  • Save tinchodev/431b5ed2819cc3821707b59d0a91aa51 to your computer and use it in GitHub Desktop.
Save tinchodev/431b5ed2819cc3821707b59d0a91aa51 to your computer and use it in GitHub Desktop.
NGINX configuration file for Magento 1.x
server {
listen 80;
server_name domain.tld www.domain.tld;
root /var/server/web/site;
location / {
index index.php index.html;
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/php7.0-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