Help to custom error 404
2025-08-30 04:53:58
#1
Hi, I'm really new with this panel and I dont know how can I change the error 404.

Recently migrate from another server and checking I get a lot of 404, the I want to custom this error to something more nice and like the other pages inside our domain.

I try with /etc/nginx/sites-enabled/mydomain.conf and there the suggestion by chatgpt and reload nginx and not working.
2025-08-30 17:47:58
#2
hibrid0 dedi:

Hi, I'm really new with this panel and I dont know how can I change the error 404.

Recently migrate from another server and checking I get a lot of 404, the I want to custom this error to something more nice and like the other pages inside our domain.

I try with /etc/nginx/sites-enabled/mydomain.conf and there the suggestion by chatgpt and reload nginx and not working.

Don’t edit /etc/nginx/sites-enabled/ because CloudPanel overwrites it. Instead, create /home/cloudpanel/htdocs/mydomain.com/nginx/custom.conf with your error_page settings, put custom-404.html in the public folder, and run systemctl reload nginx.

or

Or, alternatively, edit the vhost file in the control panel more clearly. Do not touch the site_enabled section.
Yazdığımız şeyler bizi temsil eder, Efendilik iyidir.
2025-08-30 18:27:45
#3
Rootali dedi:

Don’t edit /etc/nginx/sites-enabled/ because CloudPanel overwrites it. Instead, create /home/cloudpanel/htdocs/mydomain.com/nginx/custom.conf with your error_page settings, put custom-404.html in the public folder, and run systemctl reload nginx.

or

Or, alternatively, edit the vhost file in the control panel more clearly. Do not touch the site_enabled section.
I check the location you said, but not found.
I found this:

root@myserver😕home/clp/services/nginx# ls
basic-auth fastcgi_params koi-win modules-enabled proxy_params sites-enabled ssl-certificates win-utf
fastcgi.conf koi-utf mime.types nginx.conf scgi_params ssl uwsgi_params

but in
root@myserver: /home/clp# ls
backups htdocs logs scripts services

and under htdocs just 1 folder called app.

can you tell me small example to set the 404 error from vhost config on control panel?
2025-08-31 03:09:15
#4
I don't think you understood me.

Place the following code inside the vhost file and enter the address of your 404 page. That's all there is to it.

error_page 404 /404.html;
location = /404.html {
    root /var/www/html;
    internal;
}
Yazdığımız şeyler bizi temsil eder, Efendilik iyidir.
Please Login or Register.
Currently 2 people reading this topic. (2 guest(s))
Currently reading 0
Reacted 1
hibrid0