• 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 Apache - error

404 error is not for "domain not found", but "resource not found" (e.g. a page, a file).

To catch all non-existent subdomains, create a subdomain with the wildard * character, for example *.mydomain.ru. Then place content into its home directory that returns the desired action, e.g. a PHP script that returns a 404 error code. Maybe you can simply choose to redirect the wildcard subdomain to an existing domain.

The question is a different topic. Maybe you can choose to create a separate thread for future add-on questions that have different topics.
The above problem occurred precisely because non-existent subdomains are sent to Plesk in a folder var/www/vhosts/default/htdocs
I deleted it and after a few days (not immediately for some reason) the server stopped working.
I believe that by default, something that does not exist should not work, and in the settings of Plesk for some reason, the reverse is done
 
That is the default behavior of the Apache web server: When a virtual host entry for a non-existing domain cannot be found, the server uses the main (server) domain to answer a request. The document root for that is /var/www/vhosts/default/htdocs. Removing that folder is definitely wrong, because then the server will complain that it is missing its document root directory and it will not be able to respond to many requests properly.
 
That is the default behavior of the Apache web server: When a virtual host entry for a non-existing domain cannot be found, the server uses the main (server) domain to answer a request. The document root for that is /var/www/vhosts/default/htdocs. Removing that folder is definitely wrong, because then the server will complain that it is missing its document root directory and it will not be able to respond to many requests properly.
But when, when accessing any non-existing (arbitrary character set) subdomain, the code 200 is returned - this subdomain falls into the database of the search engines as existing. This is fundamentally not true.
 
I have encountered exactly the same problem. I'd like to ask which configuration file should I change. Since almost all the files have an annotation that the file is auto-generated.
I have Plesk installed on Debian so my directories differs from the ones presented here: Apache and Nginx Configuration Files
I found out that they are in /etc/apache2/ instead.
I found an annotation in one of the files that I should use: /var/www/vhosts/system/[DOMAIN_NAME]/conf/vhost.conf
But I need to set up the global config to use it with all the domains and subdomains, which doesn't have a site attached yet.

Can you provide me the valid config location?
 
Back
Top