Skip to content

Instantly share code, notes, and snippets.

@brianmcdo
Last active August 29, 2015 14:00
Show Gist options
  • Save brianmcdo/4eb22e98819c52873b17 to your computer and use it in GitHub Desktop.
Save brianmcdo/4eb22e98819c52873b17 to your computer and use it in GitHub Desktop.
## Magento Standard Config
server {
listen 80;
listen 443 default ssl;
## SSL START ##
ssl_certificate /srv/certs/example.com/ssl-bundle.crt;
ssl_certificate_key /srv/certs/example.com/key.key;
ssl_session_cache shared:SSL:2m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:EECDH+RC4:RSA+RC4:!MD5;
ssl_prefer_server_ciphers on;
## SSL END ##
charset utf-8;
server_name example.com;
root /srv/http/example.com;
location / {
index index.html index.php; ## Allow a static html file to be shown first
expires 30d; ## Assume all files are cachable
}
if (!-e $request_filename) {
rewrite / /index.php last;
break;
}
## 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; }
location /var/export { ## Allow admins only to view export folder
allow all;
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location ~* \.(css|js)$ { gzip_vary on; } ## Sets header to "Vary: Accept-Encoding"
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { ## Sets Expiry
expires 7d;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location ~ \.php(.*)$
{
# Pass the PHP files to PHP FastCGI for processing
try_files $uri = 404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
fastcgi_index index.php;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment