Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between virtual server and alias in apache for php?

normally, phpmyadmin is configured as alias in wamp packages and some of the projects can be configured in virtual server with port number. Can anybody explain what's the difference between these two and in which scenario any of the feature can be used?

like image 482
Kulin Choksi Avatar asked Apr 23 '11 10:04

Kulin Choksi


People also ask

What is server Alias in Apache?

ServerAlias : Alternate names for a host used when matching requests to name-virtual hosts. Most people simply use ServerName to set the 'main' address of the website (eg. 'mywebsite.com') and ServerAlias to add additional addresses the website will be bound to (eg.

What is a Virtual Host in Apache?

The Apache HTTP server supports virtual hosts, meaning that it can respond to requests that are directed to multiple IP addresses or host names that correspond to the same host machine. You can configure each virtual host to provide different content and to behave differently.

What are the types of virtual hosts in Apache?

There are two types of virtual hosts on Apache: IP-Based Virtual Hosting – every individual website on the Apache Server uses a different, unique IP address. Name-Based Virtual Hosts – enables you to add multiple domains using a single IP address.


1 Answers

Alias

An "alias" in Apache can be a directory alias, i.e.

Alias /phpmyadmin /usr/share/phpmyadmin

this means you can use http://example.org/phpmyadmin/ and http://www2.example.org/phpmyadmin/ (every host on your apache instance) to access phpmyadmin.

Virtual Host

Virtual hosts are used to host multiple domains on a single apache instance. You can have one virtual host for each IP your server has, or the same IP but different ports, or the same IP, the same port but different host names. The latter are called "name based vhosts".

Each virtual host is configured by itself and does not influence the other vhosts.

There is also a ServerAlias directive which adds another name to the name based virtual host.

like image 187
cweiske Avatar answered Nov 14 '22 02:11

cweiske