How to remove the ispconfig default errors page?

Discussion in 'Installation/Configuration' started by skysky, Jan 14, 2021.

  1. skysky

    skysky Member

    Hi
    when having errors like 404, nginx shows the ispconfig default error page. I want to show my cms 404 error page instead of ispconfig one.
    How do I do this?

    I tried to remove the below codes from vhost file, but does not work.

    Code:
     error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            recursive_error_pages on;
            location = /error/400.html {
    
                internal;
            }
            location = /error/401.html {
    
                internal;
            }
            location = /error/403.html {
    
                internal;
            }
            location = /error/404.html {
    
                internal;
            }
            location = /error/405.html {
    
                internal;
            }
            location = /error/500.html {
    
                internal;
            }
            location = /error/502.html {
    
                internal;
            }
            location = /error/503.html {
    
                internal;
            }
    part of vhost file

    Code:
      error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            recursive_error_pages on;
            location = /error/400.html {
    
                internal;
            }
            location = /error/401.html {
    
                internal;
            }
            location = /error/403.html {
    
                internal;
            }
            location = /error/404.html {
    
                internal;
            }
            location = /error/405.html {
    
                internal;
            }
            location = /error/500.html {
    
                internal;
            }
            location = /error/502.html {
    
                internal;
            }
            location = /error/503.html {
    
                internal;
            }
    
            error_log /var/log/ispconfig/httpd/macaucentral.com/error.log;
            access_log /var/log/ispconfig/httpd/macaucentral.com/access.log combined;
    
            location ~ /\. {
                deny all;
            }
    
            location ^~ /.well-known/acme-challenge/ {
                access_log off;
                log_not_found off;
                auth_basic off;
                root /usr/local/ispconfig/interface/acme/;
                autoindex off;
                index index.html;
                try_files $uri $uri/ =404;
            }
    
            location = /favicon.ico {
                log_not_found off;
                access_log off;
                expires max;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            }
    
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            }
    
            location /stats/ {
    
                index index.html index.php;
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client0/web2/web//stats/.htpasswd_stats;
                add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;";
            }
    
            location ^~ /awstats-icon {
                alias /usr/share/awstats/icon;
            }
    
            location ~ \.php$ {
                try_files /26a4187f323d896cb866b43ad71b28eb.htm @php;
            }
    
            location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/lib/php7.2-fpm/web2.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    
    
    
    
            location / {
                        try_files $uri $uri/ /index.php?$args;
    
            }
    
            location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                        return 403;
                        error_page 403 /403_error.html;
            }
    
            location ~* \.(ico|pdf|flv)$ {
                        expires 1y;
            }
    
            location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                        expires 14d;
            }
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I think you can simply change the file rather than change its location as it is definitely customizable.

    My reason is if you want to change the location in the vhost per website, it is not update proof, and ISPConfig website settings, resync or update may revert to old location. And though you may use chattr -i to its vhost, this is not advisable.
     
    Th0m likes this.
  3. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is the
    Own Error-Documents:
    turned on in Website Settings? If it is, then the error pages come from files in error/ directory in website. And like @ahrasis wrote you can edit those files.
     
    ahrasis likes this.
  4. skysky

    skysky Member

    thank you, disable Own Error-Documents setting working.
     

Share This Page