Step 1 : create the following directories
mkdir -p /www/docs
mkdir -p /www/docs/site
mkdir -p /www/docs/vhost
Step 2: add the virtual host name into the host file
vi /etc/hosts
127.0.0.1 localhost localdomain
127.0.0.1 vhost vdomain
Step 3: Enable the port listening /etc/httpd/conf/httpd.conf file
Listen 80 // default server port
Listen 8080 //another port
Step 4: Enable the Name based virtual port
NameVirtualHost *:80 // Default port for vitual host
NameVirtualHost *:8080 // Additional port for virtual Host
Step 5: Virtual host Directory Entry
# Default port custom document path
Step 6: configuration verification
#service httpd configtest
[root@localhost vhost]# service httpd configtest
Syntax OK
Step 7 : start the httpd server
#service httpd start
Step 8: browse the virtual host
default port
#links http://localhost
additional port
#links http://localhost:8080
additional virtual name
#links http://vhost
Step 9 : check the port listinng
#netstat -vatn
mkdir -p /www/docs
mkdir -p /www/docs/site
mkdir -p /www/docs/vhost
Step 2: add the virtual host name into the host file
vi /etc/hosts
127.0.0.1 localhost localdomain
127.0.0.1 vhost vdomain
Step 3: Enable the port listening /etc/httpd/conf/httpd.conf file
Listen 80 // default server port
Listen 8080 //another port
Step 4: Enable the Name based virtual port
NameVirtualHost *:80 // Default port for vitual host
NameVirtualHost *:8080 // Additional port for virtual Host
Step 5: Virtual host Directory Entry
# Default port custom document path
<VirtualHost *:80>
ServerName virtualhost
DocumentRoot /www/docs
<Directory /www/docs>
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
#Additional port with custom Document Path
<VirtualHost *:8080>
DocumentRoot /www/docs/site
ServerName virtualhost
<Directory /www/docs/site>
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
#Additional hostname with custom document path
<VirtualHost *:80>
ServerName vhost
DocumentRoot /www/docs/vhost
</VirtualHost>
ServerName virtualhost
DocumentRoot /www/docs
<Directory /www/docs>
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
#Additional port with custom Document Path
<VirtualHost *:8080>
DocumentRoot /www/docs/site
ServerName virtualhost
<Directory /www/docs/site>
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
#Additional hostname with custom document path
<VirtualHost *:80>
ServerName vhost
DocumentRoot /www/docs/vhost
</VirtualHost>
Step 6: configuration verification
#service httpd configtest
[root@localhost vhost]# service httpd configtest
Syntax OK
Step 7 : start the httpd server
#service httpd start
Step 8: browse the virtual host
default port
#links http://localhost
additional port
#links http://localhost:8080
additional virtual name
#links http://vhost
Step 9 : check the port listinng
#netstat -vatn
No comments:
Post a Comment