Skip to content

Instantly share code, notes, and snippets.

Created May 24, 2016 17:57
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 anonymous/46decfdb63152a41d29125cbdd439ccd to your computer and use it in GitHub Desktop.
Save anonymous/46decfdb63152a41d29125cbdd439ccd to your computer and use it in GitHub Desktop.
server {
listen 80;
listen [::]:80;
error_log /var/log/nginx/2wickl.de/www/error.log warn;
access_log /var/log/nginx/2wickl.de/www/access.log;
server_name www.2wickl.de 2wickl.de;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.2wickl.de 2wickl.de;
error_log /var/log/nginx/2wickl.de/www/error.log warn;
access_log /var/log/nginx/2wickl.de/www/access.log;
root /srv/http/2wickl.de/wordpress;
index index.php;
ssl_certificate /etc/nginx/ssl/2wickl.de/www.2wickl.de.crt;
ssl_certificate_key /etc/nginx/ssl/00basic-certificates/private.key;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
ssl_session_tickets off; # Requires nginx >= 1.5.9
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7
ssl_trusted_certificate /etc/nginx/ssl/00basic-certificates/ca-ocsp-bundle.pem;
resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=300s;
resolver_timeout 5s;
ssl_dhparam /etc/nginx/ssl/00basic-certificates/dhparams.pem;
client_max_body_size 1G;
# Disalow to read .htaccess-Files
location ~/\.ht {
deny all;
}
#Standard wordpress-config
# http://wiki.nginx.org/WordPress
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_intercept_errors on;
fastcgi_param HTTPS on;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment