User Tools

Site Tools


webservers:configuration_virtualhost

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
webservers:configuration_virtualhost [2023/11/02 07:18] – removed - external edit (Unknown date) 127.0.0.1webservers:configuration_virtualhost [2023/11/02 07:19] (current) – ↷ Page moved from webserver:configuration_virtualhost to webservers:configuration_virtualhost skipidar
Line 1: Line 1:
 +===== Configuration of a Virtual Host =====
 +In the example configuration the \\
 +^What ^Configuration ^
 +|Domain Name is: | paywyw.com |
 +|The webserver's Host OS is: | Ubuntu |
 +|The Apache webserver's IP is: | 176.34.101.53 |
  
 +
 +== 1. Parking and redirecting ==
 +After registering and parking the domain by some registrar (in my case Godaddy) redirect the domain to your server. \\
 +To redirect **all subdomains** to the webserver ip use the wildcard: '*' \\
 +To redirect **the domain ** paywyw.com itself to the webserver ip use: '@'
 +
 +
 +== 2. Creating the new domain ==
 +Under **/etc/apache2/sites-available** do add a new file which will represent the new Virtual Host:
 +Here are some example Virtual-Host files listed:
 +{{http://i43.tinypic.com/nldab7.png}}
 +
 +To add a default Virtual Host, which will handle redirects from any Domain do add a file named **default** 
 +(and <fc #FF0000>enable the virtual host as shown in step 3</fc>).
 +All redirects, which are not matched by any VirtualHost Entry will be handled by this VirtualHost.
 +<code>
 +<VirtualHost *:80>
 +        DocumentRoot /path/to/the/website/available/under/paywyw.com/
 +</VirtualHost>
 +</code>
 +
 +To add a default Virtual Host, which will handle redirects from a concrete (sub)domain do
 +(and <fc #FF0000>enable the virtual host as shown in step 3</fc>)
 +<code>
 +<VirtualHost *:80>
 +        ServerName subdomainname.paywyw.com
 +        ServerAlias www.subdomainname.paywyw.com
 +        DocumentRoot /path/to/the/website/available/under/paywyw.com/
 +</VirtualHost>
 +</code>
 +
 +== 3. Enabling the new Domain on the Webserver ==
 +Do run the command and pass the name of the file, representing the VirtualHost as parameter:
 +<code>
 +root@irony:~# a2ensite default
 +Site www.example.com installed; run /etc/init.d/apache2 reload to enable.
 +
 +root@irony:~# a2ensite subdomainname.paywyw.com
 +Site www.example.com installed; run /etc/init.d/apache2 reload to enable.
 +</code>
 +
 +Or just create a symbolic links in the folder **/etc/apache2/sites-enabled** to every file in the folder **/etc/apache2/sites-available**. The name of the link should be the same as the name of the file.
 +<code>
 +root@irony:/etc/apache2/sites-enabled# ln -s /etc/apache2/sites-enabled/default
 +</code>