Question

Drupal configured to handle 404/403, NGINX still displays them

In our /admin/config/system/site-information we have it set to allow Drupal to display a designed/themed 403/404 page:

Default 403 (access denied) page /customerror/403 This page is displayed when the requested document is denied to the current user. Leave blank to display a generic “access denied” page.

Default 404 (not found) page customerror/403

However, the Nginx default is still displaying: 404 Not Found nginx/1.4.6 (Ubuntu)

Our custom Nginx config file has this:

error_page 403 /customerror/403;

error_page 404 /404.html;

Should the latter also be commented out?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Default 403 (access denied) page /customerror/403 Default 404 (not found) page customerror/403 However, the Nginx default is still displaying: 404 Not Found nginx/1.4.6 (Ubuntu)

Our custom Nginx config file has this:

Find and download apps directly on your Fire TV or use a web browser to remotely queue downloads. If you need help, please visit the Fire stick customer service portal.

If it helps any Googlers, I just set the 404 in Drupal UI and then commented out the line

error_page 404 /404.html;

which I found in /etc/nginx/sites-available/ in a file called drupal

I then did ‘service nginx restart’ and it worked.

How do I "pass the request directly to the script with parameters "?

server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;

root /var/www/example/html; index index.php index.html index.htm;

error_page 403 /customerror/403;

error_page 404 /404.html; 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; }

location ~ ^/sites/.*/private/ { return 403; }

location /wordpress { return 403; }

location /getmoreinfo { return 403; }

location /fckeditor { return 403; }

location /teaching-artist { rewrite /teaching-artist/(.)$ http://example/teaching-artist/$1; } location /print/content { rewrite /print/content/(.)$ http://example/print/content/$1; }

location /content { rewrite ^/content/([^]*)([^]*)([^]*)([^]*)([^]*)([^]*)([^]*)([^]*)(.)$ http://centerforartsed.org/mediaclips/$1-$2-$3-$4-$5-$6-$7-$8-$9; rewrite ^/content/([^_])([^])([^])([^])_(.)$ http://example.org/mediaclips/$1-$2-$3-$4-$5; rewrite ^/content/([^]*)([^]*)(.)$ http://example.org/mediaclips/$1-$2-$3; rewrite ^/content/([^_])_(.*)$ http://example.org/mediaclips/$1-$2; }

location /wpadmin { return 403; }

location ~ (^|/). { return 403; }

location / { try_files $uri @rewrite; }

location @rewrite { rewrite ^ /index.php; }

location ~ .php$ { fastcgi_split_path_info ^(.+.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; 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; } }