You are here
Drupal with Virtual Hosts
Everybody's development environment is unique to them: some use Vim while others may use Dreamweaver or Notepad, some develop on a Mac while others use a PC or Linux box. The tools you use, by and large, should speed up delivery and increase the quality of your finished product. Your technology toolbox should always be growing as you learn about and add new possibilities for making your life easier. So for the lazy out there, using Virtual Hosts on your web server should be a no-brainer. So what is a Virtual Host? The Apache Software Foundation says:
-
"The term Virtual Host refers to the practice of running more than one web site (such as company1.com and company2.com) on a single machine. Virtual hosts can be 'IP-based', meaning that you have a different IP address for every web site, or 'name-based', meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user."
- Apache Virtual Host Documentation
But how does that benefit our development environment? Well, like me, you are probably using some sort of AMP stack (W*, M*, L*, X*P) to develop sites on your local machine and, while I envy the person who only works on one project at a time, you usually end up with multiple sites which need to use the same environment. This is easy enough to do but typing in the URLs for sites set up this way can be tedious and error prone. I guess you could create browser bookmarks but what if you want to take advantage of Drupal's MultiSite capabilities? Well, you need a new tool.
For our purposes, we will be creating name-based Virtual Hosts on an Apache web server. I will be using the WAMP stack, version 2.2, running Apache 2.2.21, MySQL 5.5.16, and PHP 5.3.8. I have the rewrite_module enabled on the Apache server and will be using a vanilla Drupal 7.12 standard install with pretty URLs enabled for this example. So to get set up you will need to:
- Install your AMP stack.
- Enable the Apache rewrite_module.
- Setup your site's directory in your wamp/www directory (or htdocs or sites) like:
- C:/wamp/www/your_site
Now that we're ready to get started there are four steps we need to follow:
I. Modify the hosts file.
The hosts file contains the mappings of IP addresses to host names. On Windows machines it is usually found at C:/Windows/System32/drivers/etc. Open that up in your favorite text editor. We're going to add an entry for our site following the specifications in the file: each entry is on it's own line with the IP address listed first followed by the host name with the IP address and host name separated by a least one space. As localhost is almost always 127.0.0.1 we will use that for our IP address and will add a line to the bottom of the file like:
127.0.0.1 andypangus.local
You can also create comments in this file by placing a hash (#) symbol on individual lines or following a host name. After you save the file it's on to step two...
II. Modify the httpd.conf file.
The httpd.conf file is the main configuration file for your Apache HTTP server. Depending on how you enabled the rewrite_module you may already be familiar with it. It can be found somewhere like C:\wamp\bin\apache\Apache2.2.21\conf. Open that file up in the aforementioned favorite text editor and start looking for the following two lines:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
Find those lines and remove the hash from the second so that they look like:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Save the file and on to step three...
III. Modify the httpd-vhosts.conf file.
I am only going to scratch the surface of what you can do with Virtual Hosts, for more documentation visit Apache. The httpd-vhosts.conf file contains the Virtual Hosts containers configurations. At the most basic level we need to add the following at the bottom of the file:
<VirtualHost *:80>
ServerName andypangus.local
DocumentRoot "C:/wamp/www/your_site"
</VirtualHost>
The above allows us to direct all traffic pointed at that server name to the site files in the document root. There are a slew of possibilities from this point. Here are two options:
1. Lock the site down
You can lock your development site down and prevent outsiders from accessing it on your server by adding the right configurations. Something like the following will prevent outside access to this virtual host:
<VirtualHost *:80>
ServerName andypangus.local
DocumentRoot "C:/wamp/www/your_site"
<Directory "C:/wamp/www/your_site">
Options Includes FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
2. Allow outside access
Of course, you may want to be able to access the site from somewhere other than your development machine so you could use something like:
<VirtualHost *:80>
ServerName andypangus.local
DocumentRoot "C:/wamp/www/your_site"
<Directory "C:/wamp/www/your_site">
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After you have your brand new Virtual Host configured, save the file, and restart your AMP stack. Now let's test the new setup to make sure it works. Create an index.html file with some basic markup and drop it in C:/wamp/www/your_site. Something like:
<html>
<head><title>Virtual Host Test</title></head>
<body><p>Your shiny new Virtual Host is ready to go!</p></body>
</html>
Now point your browser at andypangus.local and load her up. You should see something like:
Once you have successfully landed at your Virtual Host, delete the index.html file you just created and add and configure the Drupal files in the same directory. Once you have finished running the install script you need to complete the last step.
IV. Modify the settings.php file.
Open up your new site's settings.php file and find the following line:
# $base_url = 'http://www.example.com'; // NO trailing slash!
I have found that without modifying the above line that relative paths in my site fail right, left, and center. So, turn the above into something like:
$base_url = 'http://andypangus.local'; // NO trailing slash!
Now save the file and clear your site's cache. Don't forget to enable the pretty, pretty URLs and you're ready to go.
- Add new comment
- 4 comments


people of dong ethnic group
people of dong ethnic group live in different semi formal dresses areas with various customs cocktail dresses online and traditions on wedding.Change Lantern CordOn the wedding eve, flower girl dresses there is a way guide who is chosen by orange bridesmaid dresses the groom's relatives to hang the bridegroom;s lantern on the bride;s door while hastening the bride three times to set off. The bride will floor length wedding dresses go out of the door reluctantly and then cheap wedding dresses leave for the short wedding dresses bridegroom;s house with the way guide. And before that, the bride will cut off the grass cord of the lantern and take out a ribbon to fasten the lantern. This is to indicate that her and the bridegroom's hearts have already closely linked together.Charming Dong Silver Jewelry and Embroidery Wedding GownThe Dong ethnic minority regards silver as precious material for most dazzling jewelry. For Dong people,silver jewelry comprising corollas, hairpins, combs, chaplets, necklaces, bracelets, rings and earring will be amassed for young girls by their family since their childhood.It is a complicated process for making even vintage wedding dresses a single hand-made Embroidery Wedding Gown with about six to seven embroidery techniques.
Mother always begins to
Mother always begins to prepare for daughter's wedding gown as soon as the baby girl flower girls dresses is born. There are fantastic embroidered images of trees, geometrical figures, flowers and plants on the wedding gown and all of these are hand-made.The precious wedding gown is viewed as the most splendid costume in whole life of a girl in Dong ethnic group. You can't imagine that some brides even casual wedding dresses wear gowns cocktail dresses online that have been passed down from formal dress their grandmothers. And after wedding ceremony, the wedding gown will be worn only on special festivals.Trial MarriageThere is special" Trial Marriage" for people of Dong ethnic group. According to their wedding rituals, it is prom dresses forbidden for the bride;s family members to enter the groom;s village during the first day of the wedding celebration and the newlyweds will not live simple wedding dresses together directly after the Dong Ethnic Minority Wedding. They will firstly modest bridesmaid dresses have plus size wedding dresses a trial marriage instead. During this period, the groom best prom dresses has the right to ask for a divorce if the bride doesn't get pregnant; in return, the bride also keeps her right to love someone else.
The new beloved knee length
The new beloved knee length bridesmaid dresses one of the bride only has to pay hetalia cosplay double prom dress stores betrothal cheap bridesmaid dresses gifts: one is to make compensation for the black cosplay wig former bridegroom while cocktail dresses the other is for the bride. Thus it can be seen that the marital inexpensive homecoming dresses customs Dong ethnic group are quite liberating.Solid Diet on WeddingThe people of Dong ethnic group have inherited characteristics of hospitality and diligence. You don't have to give monetary gifts; a basket of traditional food is enough as wedding gift. The pictures below show the various and distinctive food for wedding. There is no evening dresses doubt that you will have a solid plus size mother of the bride dresses with sleeves diet on their wedding.Monba ethnic group resides mainly in Medog, Nyingchi and Cuona Counties in the Tibet Autonomous Region. "Monba" refers to the people living in a beautiful virgin land. The wedding ceremony is quite interesting in Monba ethnic group.Drinking three timesOn the wedding day, it is two groomsmen and two groom's relatives who are responsible for escorting the bride to vintage prom dresses the groom's home. As the bride;s relatives play the most important role at the wedding, the groom's family will ingratiate them with wine.
V2 Cigs Evaluation - V2 Cigs For Far better Wellness?
A variety of makers have stainless oral cavity piece along with out need to obtain the plastic whenever leaking. The mouthpiece or cartridge exists in virtually every e cigarettes. It could be get rid of or substitute is needed after a particular time period.
In V2 cigs consumer manual, it is actually mentioned that -If you in fact wish to regulate you smoking behavior with V2 cigs after that v2 cigs neighborhood is grateful for you and values those that can certainly eliminate this evil routine.
If you believe it will certainly help, try out some of the nicotine products that can easily help you give up. This is called nicotine substitute therapy, and these products provide you a little of nicotine through gum, spots, gels and more. Some individuals can easily stop without nicotine substitute products while others choose them since it helps to minimize the extreme yearnings. You must also browse some means to obtain rid of anxiousness, worry and all the various other things you're feeling during present. We had a great deal of fun placing this information with each other because this subject matter of v2 cigs coupons voucher resources truly captivates us. Of course, do not quit along with what you are learning listed here today; that would be a shame.
There are tremendous advantages you will experience when you apply what you understand about v2 cigs evaluation topics. The majority of people, the majority of them, not doing anything all throughout their lives and nothing good happens from that.
The comments for this tool has been incredible and a number of individuals across the globe have actually experienced the benefits of this great tool. This gadget has actually proven to be the most enticing to people who are either light cigarette smokers or they would like to stop vamp totally. This gadget has now come to be a lot more compact and far more easy to hold about rather than when they were initial made, these tools used to be quite huge in size and tough to hold around.
Celebs also utilize this as a kind of smoking this includes the popular Jimmy White that uses vapor cigarettes on a normal basis at contests as apposed to the routine technique of cigarette smoking. Alan Tichmarsh and his 400th program likewise seen the e cigarette make an appearance as he smokes one on nationwide television and he also handed them out free of cost to his audience. Also Paris Hilton has been identified out and regarding utilizing the e cigarette.
E cigarettes are intended at chain cigarette smokers that truly prefer to give up the bad habit of vamp. A v2 electric cigarette is the most recent innovation of vapor cigarettes to load the market.cigarettes.
The Americas and the travelers who 'discovered' them provided the world the gift plant called tobacco. In our modern world, tobacco takes the form of the cigarette. When initially utilizing tobacco, many individuals thought about pipelines to be the ultimate cigarette smoking device, not the cigarettes we have today. After decades of testing, the contemporary cigarette was birthed. Now we have come to a turning point through which existing cigarettes are coming to be much less preferred, and e cigs like V2 cigs are becoming progressively well loved. Both the cigarette smoker's health and the globe's health and wellness increases when utilizing V2 cigs rather of typical ones.
Post new comment