Last active
April 27, 2016 22:27
-
-
Save imchairmanm/eaa16e6c7a459e9f76aa5d0aaf507e62 to your computer and use it in GitHub Desktop.
Self-signed SSL Nginx server block
This file contains 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 default_server; | |
listen [::]:80 default_server; | |
server_name example.com; | |
return 302 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl http2 default_server; | |
listen [::]:443 ssl http2 default_server; | |
include snippets/self-signed.conf; | |
include snippets/ssl-params.conf; | |
root /var/www/html; | |
index index.php index.html index.htm index.nginx-debian.html; | |
location = /favicon.ico { log_not_found off; access_log off; } | |
location = /robots.txt { allow all; log_not_found off; access_log off; } | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
location / { | |
try_files $uri $uri/ /index.php$is_args$args; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment