Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Created January 22, 2013 15:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deivisonarthur/4595778 to your computer and use it in GitHub Desktop.
Save deivisonarthur/4595778 to your computer and use it in GitHub Desktop.
##Server para redirecionar
server {
listen 80;
server_name pisosecarpetes.com.br *.pisosecarpetes.com.br;
##Pega subdominio e add https
if ($host ~* "^([^.]+(\.[^.]+)*)\.pisosecarpetes.com.br$"){
set $subd $1;
rewrite ^(.*)$ https://$subd.pisosecarpetes.com.br$1 permanent;
break;
}
##Pega principal e redireciona subdominio com https
if ($host ~* "^pisosecarpetes.com.br$"){
rewrite ^(.*)$ https://shop.pisosecarpetes.com.br$1 permanent;
break;
}
##rewrite ^ https://$server_name$request_uri? permanent;
##charset utf-8;
}
server {
listen 80;
listen 443;
##rewrite ^(.*)$ http://shop.pisosecarpetes.com.br$1 permanent
## SSL directives might go here
server_name shop.pisosecarptes.com.br 54.232.99.116;
ssl on;
ssl_certificate /usr/share/nginx/certificado-2048/pisosecarpetes.crt;
ssl_certificate_key /usr/share/nginx/certificado-2048/servidor.key;
location / {
root /usr/share/nginx/html;
index index.php index.html; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}
## These locations would be hidden by .htaccess normally
location ~ (/(app/|includes/|/pkginfo/|var/|report/config.xml)|/\.svn/|/\.git/|/.hta.+) {
deny all;
}
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; #nao usar cache pra php (dinamico)
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 1200;
send_timeout 1200;
proxy_read_timeout 1200;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment