Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Apache sets the default virtual host

Shulou Source: shulou.com Published: 2022-06-01 03:59:23 10月06日 Update

Default virtual host

To prevent other domain names that are not our own from being resolved to our own IP, we can restrict other domain names by changing the virtual host file / usr/local/apache2/conf/extra/httpd-vhosts.con. We created a new virtual host and created a new empty directory with its permissions set to 600. In this way, only the domain name we defined in the configuration file can be accessed.

The command is as follows:

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

Add the following code to the location of the first virtual host:

DocumentRoot "/ tmp/123"

ServerName 1111.com

Save exit

Mkdir / tmp/123

Chmod 600 / tmp/123

Apachectl-t

Apachectl restart

Tags: Hosts virtual hosts domain names files codes locations only commands permissions empty directories configurations restrictions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS Shulou Technology OPPO Reno MariaDB