Skip to content

Instantly share code, notes, and snippets.

@paulofreitas
Last active May 17, 2017 17:13
Show Gist options
  • Save paulofreitas/2d9d8132754810792847401e8bc9e566 to your computer and use it in GitHub Desktop.
Save paulofreitas/2d9d8132754810792847401e8bc9e566 to your computer and use it in GitHub Desktop.
Nginx virtual host sample
server {
listen 80;
server_name www.dominio.com.br;
return 301 $scheme://dominio.com.br$request_uri;
}
server {
listen 80;
server_name dominio.com.br www.dominio.com.br;
root /home/root/dominio.com.br/public;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /home/root/dominio.com.br/storage/logs/access.log combined;
error_log /home/root/dominio.com.br/storage/logs/error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment