0

I come to you because I can not find the solution to my problem yet simple at the base, but that does not work, I looked in several forums and the Nginx documentation, but no way to display my error pages personal.

Let me explain, I want to display my personal error pages via Nginx with rutorrent, good j'i then proceeded as follows:

I created a folder that I called "error_pages" at the location "/var/www/" in which I created all my pages 400.html 401.html 403.html 404.html 503.html 50x .html

error_pages

  Then I created the apge configuration "erroe_pages.conf" I placed in the "/etc/nginx/conf.d/" and on this page I wrote the following code:

error_page 400 /error_pages/400.html;
location = /400.html {
    root /var/www/;
    internal;
}

error_page 401 /error_pages/401.html;
location = /401.html {
    root /var/www/;
    auth_basic off;
    allow all;
    internal;
}

error_page 403 /error_pages/403.html;
location = /403.html {
        root /var/www/;
        allow all;
}

error_page 404 /error_pages/404.html;
location = /404.html {
        root /var/www/;
        auth_basic off;
        internal;
}

error_page 503 /error_pages/503.html;
location = /503.html {
        root /var/www/;
        auth_basic off;
        internal;
}

error_page 500 501 502 504 /error_pages/50x.html;
location ^~ /error_pages {
        root /var/www/;
        internal;
}

Then in the rutorrent.conf file from the "/etc/nginx/sites-enabled" I placed this line of command at the party server {listen 80 ......

## inclure pages erreurs ##
 include /etc/nginx/conf.d/error_pages.conf;

I do not understand why my custom error pages will not appear instead of the default Nginx :(

Thank you for your help !

  • Does nginx -t show any errors? You did restart nginx after making the config changes? – Richard Smith Mar 12 '16 at 10:19
  • Yes in SSH I verification is good with nginx -t is OK and after I restart all time nginx with the command service nginx restart and I clear the history and cache of my browser before testing. I know it should focntionner but unfortunately it does not work and I do not understand why and I turn around – reaman Mar 12 '16 at 12:56
  • Why have you added all theese location blocks? What is the root directive in your sites-enabled file for this virtual host? – Tero Kilkanen Mar 12 '16 at 18:33
  • Thet's it: /etc/nginx/sites-enabled/rutorrent.conf I added these guidelines to show custom error pages, even if I'm not staying in or adding auth_basic off;page to be displayed even if not identhifié, example if I write the URL of my apge identification of type https: // www.mysite.com / rutorrent / index.html I go on the page that asks me to authenticate me, if I click to cancel authentication I display the error page 401 of origin to Nginx and if I am mistaken in the address RUL and I write: https: //www.mysite/toto is authetification display the window, not the 404 page for URLs. – reaman Mar 13 '16 at 9:06
  • The code of my page rutorrent of /etc/nginx/sites-enabled/ : [link] pastebin.com/XCDeX2sy – line 47 is my include – reaman Mar 13 '16 at 16:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.