Thoughts inspiring. Inspiring thoughts
Creating subdomain(s) in any web development environment is essential. For example, I have 2 projects going on at the same time and developement is concurrent. And subdomains were not created. So we have this scenario:
As you can see, I am assuming a Apache/PHP/MySql developemnt stack. 3 localhost urls that will be frequently accessed. Imagine what will happen when you want to access beta project? You “control+t” a new browser tab, and type in “localhost” only to have the url bar showing its history of the above 3 urls. Then you press the down arrow key to access the required url.
Waste of keystroke I will say. Now we create subdomains and we have:
So now when we want to access beta project? Type in “beta” and simply selected the required “remembered” url. Save some keystrokes and it will save up a a sizable amount of effort over time.
So how to create subdomain in Ubuntu?
Simple, I will cover the basic steps here. (Windows users, sorry, not here my friends).
Edit /etc/host and add the following line
127.0.0.1 alphaproject.localhost
Create a new configuration file in /etc/apache2/sites-available/alphaproject using
gksudo gedit /etc/apache2/sites-available/alphaproject
In this configuration file, have the following:
<VirtualHost *> DocumentRoot /home/username/alphaproject/ ServerName alphaproject.localhost<Directory /home/username/alphaproject/> Options Indexes FollowSymLinks MultiViews +Includes AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost>
Save the file, and run the following:
sudo a2ensite myconfig
Finally restart the Apache Server. Which I assume you should be using Apache2.
sudo /etc/init.d/apache2 restart
And by going to http://alphaproject.localhost/ you should be able to access you newly created subdomain.
On a ending note, phpmyadmin does come installed as a package but default to http://localhost/pma which I do strongly encourage users to change it to http://pma.localhost/
Think of the key strokes you be saving. And yes, do name your subdomain smartly, try picking each subdomain to have a different starting character.
ThinkingNectar talks about the interest of Chin Yong, a PHP developer residing in Singapore. Life, society, and codes should entails most of what goes between the ears of this Kopi-O drinker.
What makes you think?
Tim Graham
March 29th, 2008 at 5:30 pm
An important note if you want to use .htaccess files to enable features like mod_rewrite: AllowOverride should be set to “All” instead of “None”
Getting Ubuntu to work: The Heron Had Landed | ThinkingNectar
May 6th, 2008 at 6:08 pm
[...] took another 30 minutes. Very much painless, less that the fact that I need to recheck every single Apache subdomain that I had created to make sure that there are still working. It was pretty scary when the updates [...]