server { # listen 80 default_server; # listen [::]:80 default_server ipv6only=on; listen 443 ssl; server_name ourdomain.org; ssl_certificate /pathto/fullchain.pem; ssl_certificate_key /pathto/privkey.pem; access_log /var/log/prod_access; error_log /var/log/prod_error.log; root /pathto/html; index index.php index.html index.htm; #added lets encrypt location ^~ /.well-known/ { allow all; } # error_page 403 /customerror/403; # error_page 404 /404.html; error_page 404 http://url/page-not-found; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ \..*/.*\.php$ { return 403; # /no-such-page; } # return 404; # } location ~ ^/sites/.*/private/ { return 403; } # location /wordpress { # return 403; # } location /getmoreinfo { return 403; } location /fckeditor { return 403; } # location /wpadmin { # return 403; # } location ~ (^|/)\. { return 403; } location / { # try_files $uri @rewrite; # for Drupal 6 try_files $uri /index.php?$query_string; # For Drupal >= 7 } location @rewrite { # rewrite ^ /index.php; rewrite ^/(.*)$ /index.php?q=$1; } location ~ \.php$ { # fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+?\.php)(|/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php5-fpm.sock; } location ~ ^/sites/.*/files/styles/ { try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }