Last active
December 28, 2018 05:58
-
-
Save fieldAbyss/3ffdc2f1bfb14435e5830fd01c294229 to your computer and use it in GitHub Desktop.
Nginx + SSL + Laravel /etc/nginx/sites-available/example.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen [::]:80; | |
server_name example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
include snippets/ssl-example.com.conf; | |
include snippets/ssl-params.conf; | |
root /var/www/html/example.com/public; | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name example.com; | |
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; } | |
error_page 404 /index.php; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
location ^~ /.well-known/acme-challenge/ { | |
# mkdir /var/www/letsencrypt | |
root /var/www/letsencrypt; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment