Setting up our first server
If you want to learn web development, you have to learn how to set up your websites. Usually we only have to do this step once per website or property.
Using Notepad++, click on the heart icon from the navigation icons (the set of 3 icons to the right). In the Favorites pane, right click on “Files” and click “New Link…”
Navigate to the following folder: C:\wamp\bin\apache\apache2.4.9\conf and double click on the “httpd.conf” file. For name, just name it “httpd.conf” so it matches the file name you’re linking. Keep things simple.
Do the same for C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf and C:\windows\System32\drivers\etc\hosts
To really learn web development and learn to do it from any machine, these following steps are crucial. You need to learn how to set up servers so you can have unlimited projects that you can work on.
Create a website folder:
Navigate to c:\wamp\www and create a new folder. Let’s call it: c:/wamp/www/local.website.com. This is is where your files for your websites will reside.
Enable Virtual Hosts:
Once done setting up those files, open your httpd.conf file from favorites. Search for “conf/extra/httpd-vhosts.conf“. Notice the # comment tag in front of the line. Remove it and save the file. This tells apache where to look for your virtual hosts, or websites. It’s another configuration file.
Add a virtual host:
This is going to be your first website. Open up the httpd-vhosts.conf file from your favorites. Replace everything in the file with the following:
<VirtualHost *:80> DocumentRoot "c:/wamp/www/local.website.com" ServerName local.website.com <Directory "c:/wamp/www/local.website.com"> Options Indexes FollowSymLinks AllowOverride all Require local </Directory> </VirtualHost>
For every server / virtual host you want to add, replace the local.website.com with the name of your new property / website. Add one of these for each property you run.
Add a host entry:
We need a host entry for our website so that our browser can recognize where to look for your website.
Open up hosts from your Favorites. Add a new entry for your website:
... 127.0.0.1 local.website.com ...
One more thing we need to do is restart WAMP (click on the WAMP icon in your toolbar, click “restart all services“.
The icon will turn red, then possibly orange, then green. If it doesn’t you might have typed something incorrectly. Follow the steps again.
Next: Our first website.