Skip to content

Instantly share code, notes, and snippets.

@daryltucker
Last active August 29, 2015 13:57
Show Gist options
  • Save daryltucker/9395555 to your computer and use it in GitHub Desktop.
Save daryltucker/9395555 to your computer and use it in GitHub Desktop.
Skeleton NGINX Configuraton (Forces SSL)
server{
server_name domain.tld;
rewrite ^ https://domain.tld$request_uri? permanent;
}
server{
ssi on;
listen 443;
server_name domain.tld;
ssl on;
ssl_certificate /etc/sslcerts/domain.tld.crt;
ssl_certificate_key /etc/ssl/certs/domain.tld.key;
ssl_prefer_server_ciphers On;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:ECDHE-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA;
root /srv/www/domain.tld/html/;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php /index.html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_intercept_errors on;
# Install php-fpm
fastcgi_pass unix:/var/run/php-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment