Skip to content

Instantly share code, notes, and snippets.

@imchairmanm
Last active April 27, 2016 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imchairmanm/eaa16e6c7a459e9f76aa5d0aaf507e62 to your computer and use it in GitHub Desktop.
Save imchairmanm/eaa16e6c7a459e9f76aa5d0aaf507e62 to your computer and use it in GitHub Desktop.
Self-signed SSL Nginx server block
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