File not found error, instead of 404 not found page

Post Reply
dmitlife
Posts: 4
Joined: Wed Nov 16, 2022 1:49 am

Hello. I have installed MyVesta several times on Debian 11 servers. My settings line

Code: Select all

--apache yes --nginx yes --phpfpm no --vsftpd no --proftpd yes --named yes --mysql yes --mysql8 no --postgresql no --exim yes --dovecot yes --clamav no --spamassassin no --iptables yes --fail2ban yes --quota no --force no --interactive no
All day I can not understand the error. The problem is the "File not found" error. I installed Myvesta on two different servers from different hosting providers on Debian 11, but the error persists everywhere.
The error lies in the fact that on the site I can safely go to the php page if it exists. But if the php page does not exist, then I am not redirected to the 404 error page, but only a small inscription "File not found" is shown.
Image
The 404 page error does not appear on non-existent php pages and others with an arbitrary extension. But if there is no html page, js, css files, different images, then instead of them, the 404 page appears without any problems.
If you go to mydomen.com/error/404.html , then the 404 page works fine. I have set the commands in the .htaccess file,

Code: Select all

ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 500 /error/50x.html
but it didn't help, the 404 error page doesn't appear when the php page doesn't exist. Only the message "File not found" appears.
If I set the command in the .htaccess file,

Code: Select all

<Files "myfile.php">
Deny from all
</Files>
then 403 protection immediately appears when you go to myfile.php, but 404 does not want to appear.

If it helps, my code from mydomen .ru.nginx.ssl.conf file

Code: Select all

server {
    listen      111.222.111.222:443 ssl http2;
    server_name mydomen.com www.mydomen.com;

    ssl_certificate      /home/admin/conf/web/ssl.mydomen.com.pem;
    ssl_certificate_key  /home/admin/conf/web/ssl.mydomen.com.key;
    error_log  /var/log/apache2/domains/mydomen.com.error.log error;

    location / {
        proxy_pass      https://111.222.111.222:8443;
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|odt|ods|odp|odf|tar|wav|bmp|rtf|js|mp3|avi|mpeg|flv|woff|woff2)$ {
            root           /home/admin/web/mydomen.com/public_html;
            access_log     /var/log/apache2/domains/mydomen.com.log combined;
            access_log     /var/log/apache2/domains/mydomen.com.bytes bytes;
            expires        max;
            # try_files      $uri @fallback;
        }
	}
	
    location /webmail {
        disable_symlinks off;
        proxy_pass      https://111.222.111.222:8443;
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|odt|ods|odp|odf|tar|wav|bmp|rtf|js|mp3|avi|mpeg|flv|woff|woff2)$ {
            root           /var/lib/roundcube;
            access_log     /var/log/apache2/domains/mydomen.com.log combined;
            access_log     /var/log/apache2/domains/mydomen.com.bytes bytes;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /phpmyadmin {
        disable_symlinks off;
        proxy_pass      https://111.222.111.222:8443;
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|odt|ods|odp|odf|tar|wav|bmp|rtf|js|mp3|avi|mpeg|flv|woff|woff2)$ {
            root           /usr/share;
            access_log     /var/log/apache2/domains/mydomen.com.log combined;
            access_log     /var/log/apache2/domains/mydomen.com.bytes bytes;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/admin/web/mydomen.com/document_errors/;
    }

    location @fallback {
        proxy_pass      https://111.222.111.222:8443;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.env   {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    disable_symlinks if_not_owner from=/home/admin/web/mydomen.com/public_html;

    include /home/admin/conf/web/snginx.mydomen.com.conf*;
}
And if you need the Apache mydomen.com.apache2.ssl.conf file

Code: Select all

<VirtualHost111.222.111.222:8443>

    ServerName mydomen.com
    ServerAlias www.mydomen.com
    ServerAdmin [email protected]
    DocumentRoot /home/admin/web/mydomen.com/public_html
    ScriptAlias /cgi-bin/ /home/admin/web/mydomen.com/cgi-bin/
    Alias /vstats/ /home/admin/web/mydomen.com/stats/
    Alias /error/ /home/admin/web/mydomen.com/document_errors/
    #SuexecUserGroup admin admin
    CustomLog /var/log/apache2/domains/mydomen.com.bytes bytes
    CustomLog /var/log/apache2/domains/mydomen.com.log combined
    ErrorLog /var/log/apache2/domains/mydomen.com.error.log
    <Directory /home/admin/web/mydomen.com/stats>
        AllowOverride All
    </Directory>
    <Directory /home/admin/web/mydomen.com/public_html>
        AllowOverride All
        SSLRequireSSL
        Options +Includes -Indexes +ExecCGI
	</Directory>
    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile /home/admin/conf/web/ssl.mydomen.com.crt
    SSLCertificateKeyFile /home/admin/conf/web/ssl.mydomen.com.key
    SSLCertificateChainFile /home/admin/conf/web/ssl.mydomen.com.ca
#    <IfModule mod_ruid2.c>
#        RMode config
#        RUidGid admin admin
#        RGroups www-data
#    </IfModule>
#    <IfModule itk.c>
#        AssignUserID admin admin
#    </IfModule>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php7.4-fpm-mydomen.com.sock|fcgi://localhost/"
    </FilesMatch>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    IncludeOptional /home/admin/conf/web/sapache2.mydomen.com.conf*

</VirtualHost>
Please tell me how to fix this?
dmitlife
Posts: 4
Joined: Wed Nov 16, 2022 1:49 am

Thank you all for your replies, I solved this problem on my own in a couple of hours. I realized that if you don’t help yourself, then no one will help, Very bad.
Post Reply