server { listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/www.imglol.de/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/www.imglol.de/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot root /var/www/vhosts/imglol.de; server_name www.imglol.de imglol.de; access_log /var/log/nginx/imglol.de/imglol-access.log imglol; error_log /var/log/nginx/imglol.de/imglol-error.log; index index.html index.htm index.php; autoindex off; if ($host ~* ^www\.(.*)) { set $host_without_www $1; rewrite ^(.*) https://$host_without_www$1 permanent; } location / { try_files $uri $uri/ =404; if (!-e $request_filename) { rewrite ^/([^/.]*)/?$ /index.php?page=$1 last; rewrite ^/Uploads/([0-9]+)/?$ /index.php?page=Uploads&pageID=$1 last; } } location /u { allow 127.0.0.1; deny all; } location ~* \.php$ { fastcgi_pass unix:/var/run/php5-fpm-imglol.sock; fastcgi_intercept_errors on; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }