DNS binding A Record #
First, a record is created on DNS, and the domain name is bound to the corresponding IP.
Create a Site Directory #
On the server, add the/srv/www/vhosts/www.111cn.net directory and create a index.html file in the directory – for testing.
Configure apache#
Create a virtual host configuration file #
The code is as follows |
Copy Code |
$ cd/etc/apache2/vhosts.d $ sudo cp vhost.template www.111cn.net.conf
|
The contents of the modified Www.111cn.net.conf file are as follows:
The code is as follows |
Copy Code |
<virtualhost *:80> ServerName www.111cn.net ServerAdmin chenxsan@gmail.com Documentroot/srv/www/vhosts/www.111cn.net Errorlog/var/log/apache2/www.111cn.net-error_log Customlog/var/log/apache2/www.111cn.net-access_log combined # don ' t loose time with IP address lookups Hostnamelookups off # needed for named virtual hosts Usecanonicalname off # Configures the footer on server-generated documents Serversignature on # # This should is changed to whatever your set DocumentRoot to. # <directory "/srv/www/vhosts/www.111cn.net" > AllowOverride All Options FollowSymLinks Order Allow,deny Allow from all </Directory> </VirtualHost> |
Then restart Apache:
$ sudo rcapache2 restart
Access to the Www.111cn.net URL, you can already see the contents of the index.html file. If we have not added index.html files before, we will receive the following error message:
Access forbidden!
You are don ' t have permission to access the requested directory. There is either no index document or the directory is read-protected.
If You are a server error, please contact the webmaster.
Error 403
www.111cn.net