• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Custom 500 error page

TomKeur

New Pleskian
Hi,

I'm tring to add an custom 500 page to subdomain, it seems that this is not working, but I'm not sure if I'm doing something wrong.

I'm using the Linux edition running on Ubuntu 16.04.
This is what I tried:

Enable "Custom error documents" on Hosting settings for the subdomain and main domain, after that I edited the file "internal_server_error.html" file in /var/www/vhosts/domain.tld/error_docs.
This was not working.

After that I tried:
At the "Apache & nginx Settings"
By "Additional directives for HTTP & Additional directives for HTTPS ":
Code:
ErrorDocument 500 https://other.domain.tld/500.html;
This was not working.

So I tried:
"Additional nginx directives":
Code:
error_page 505 https://other.domain.tld/500.html;
Not working.

Last thing I've tried:
ErrorDocument 500 https://other.domain.tld/500.html; in my .htaccess in the document root.
Not working.

All of the things above are not working, I'm seeing the default browser error page. I've tried this in multiple browsers and all with no success.

My settings:
nginx settings: "Proxy mode" is checked, I'm using my htaccess for rewrite rules.

I'm creating the 500 error with an syntax error in my php file.

Hopefully someone can help me on this one.
Thanks in advance!
 

Attachments

  • Screen Shot 2016-12-08 at 11.07.47.png
    Screen Shot 2016-12-08 at 11.07.47.png
    23.6 KB · Views: 5
Hi TomKeur,

I'm tring to add an custom 500 page to subdomain, it seems that this is not working, but I'm not sure if I'm doing something wrong.
... sorry to write that... but I know for sure, that you decided to go the wrong steps to achive your goal.

Each subscription/hosting - plan has the option to use "Custom error documents", which can be setup at the "Hosting parameters". Once setup, the domains have existing errors docs, defined over the "Virtual host templates" at : "Home > Tools & Settings > Virtual Host Template".
If the "Custom error documents" is setup, your domain - specific error - documents are located at "/var/www/vhosts/YOUR-DOMAIN.COM/error_docs" ( the "Error 500" - document is for example named: internal_server_error.html , consider to change the content to your desired layout and content ).
 
Last edited by a moderator:
Hi UFHH01,

Thank you for your reply!

I changed the: "/var/www/vhosts/YOUR-DOMAIN.COM/error_docs/internal_server_error.html" page, but I'm still getting the browsers default error page (in Chrome), in Firefox I receive an White screen, when I look at the source it's empty.
I removed all the custom directives (nginx & apache).

So it's not that one that I've uploaded in the error_docs, does it make any difference that I'm using Apache and Nginx?
 
Hi TomKeur,

does it make any difference that I'm using Apache and Nginx?
Sure it does... NGINX uses by default the error documents from the folder "/etc/nginx/html", with the definitions at "/etc/nginx/nginx.conf". If you desire "global" changes, you would choose the default settings from "nginx.conf.default" for example and if you desire (sub)domain - specific error documents, you would add "Additional NGINX directives", as for example:

Code:
        error_page   500  /internal_server_error.html;
        location = /internal_server_error.html {
            root   /var/www/vhosts/YOUR-DOMAIN.COM/error_docs;
        }


Find commands to search for you current (sub)domain - specific configuration:
Code:
For APACHE:

find /var/www/vhosts/system/YOUR-DOMAIN.COM/conf -type f -name "*.conf" -exec grep --color -Hni "/error_docs/"  {} \;


For NGINX:

find /var/www/vhosts/system/YOUR-DOMAIN.COM/conf -type f -name "*.conf" -exec grep --color -Hni "error_page"  {} \;
 
Thank you for your reply!
I fixed it with the following:

Code:
# Needed since the errors are coming from our backend.
proxy_intercept_errors on;

# Custom 500 page.
error_page   500  /internal_server_error.html;
location = /internal_server_error.html {
        root   /var/www/vhosts/autoprofijt.nl/error_docs;
        internal;
}
Since the errors were coming from my backend I needed to add proxy_intercept_errors.
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors

Thanks for your help! Up and running and happy :)[/code]
 
Back
Top