This is blog which contains my achievement in masters. I will try to put all the information I got from the university in chronological order.

Tuesday, April 12, 2016

Apache2 Server Subdomains

Apache2 Server configuration for multiple web applications is confusing for beginners. Since I have just started configuring apache server in my Ubuntu 14.04 system, I am going to share my experiences while installing and configuring Apache Server.

Basic Commands

Here are the basic commands need to learn:

1) Installation :sudo apt-get install apache2
2) Reload: sudo service apache2 reload
3) Restart:sudo service apache2 restart
4) Enable website: sudo a2ensite [WEBSITE_NAME]
5) Disable website:sudo a2dissite [WEBSITE_NAME]Problem ScenarioSo, the problem scenario is I have to install multiple web applications in the same host but with different URLs. And the web applications can be placed anywhere in the server. And I also discuss about defining sub-domains. For example, I have three web projects located in /home/frietec/www/redmine, /home/frietec/www/owncloud, /home/frietec/www/ldap and I want to access these projects with redmine.frietec.com, cloud.frietec.com, ldap.frietec.com.

SolutionThe solution for this is not so difficult. We need to configure virtual host. First of all, we have to define the virtual hosts in config file as below:

In this example, it is important that the defined sub-domains should point to the same local machine. So, we either place this information to a DNS server to publicly access. To test in local network, we modify the file /etc/hosts with the subdomains point to the same IP. This way removed the burgeon of remembering the ip-address of the system.