- You rented a server that previously hosted a website or websites. The previous owner did not change the A-records and his domains are still directed to your server.
- If someone accidentally or maliciously directed their domain to your server. Those. indicated in the A-record of your domain the IP of your server.
To prevent this from happening, a stub site will open if visitors get to your server from someone else's domain you don't need.
To create a stub site:
1. Create a domain with an arbitrary name in the VestaCP panel. For example site.plug. To do this, log in to the panel. Next, in the WEB menu - Create a domain. In the Domain field, enter site.plug (or any arbitrary name) and click Add. You also need to create a self-signed SSL certificate for this domain. To do this, go to the WEB menu - for the site.plug domain, press the EDIT button
In the domain properties window that opens, check the SSL Support box and click Generate CSR. In the certificate generation window, paste the name of the stub site (site.plug) into the Domain field and click Generate,
then the Add button and then Save.
2. Connect to the server via SSH (for example, using the putty program).
3. Скопируйте команду в окно консоли и нажмите Enter
(to do this, just copy the line and right-click on the console window, paste)
In the file that opens, you need to move the lines (there will be 2 of them) that mention site.plug to the very top of the file
To do this, move the cursor to the first line mentioning site.plug, press dd (cut), then move the cursor to the very top of the document and press the letter p (paste). Do the same for the second line.
The result should look like this
Save the file and close it by pressing Shift + Z + Z (if you did something wrong, you can close the file without saving Shift + Z + Q and try again by running the command indicated at the beginning of the paragraph)
Run the command to apply the changes (copy to the console window and press Enter).
systemctl reload nginx
4. Perform exactly the same actions in another file.
To open it, run the command (copy the link and press Enter):
Attention! If there are no lines in the opened file (it will be empty), just close the file without saving (press the combination Shift + Z + Q)
If the file is not empty and the changes have been applied, save it and close it by pressing the Shift+Z+Z combination. Then run the command:
systemctl reload httpd
As a result, you have created a stub site that will open if third-party domains are directed to your server.