confused about folder name and local name
Posted by: markIV (103.5.184.---)
Date: January 15, 2015 08:46AM

1 - Windows version used (Specify whether 32 or 64 bit): 64
2 - Version WampServer (Specify whether 32 or 64 bit): 32
3 - Apache Version 2.4.9
4 - PHP Version 5.5.12
5 - MySQL Version 5.6.17
6 - What color is the WampServer icon (in the notification area of the taskbar)? Green

Greetings,
As I understand, to avoid any conflict between addresses of local and live websites, we avoid using site name (say for sake of example, xyz or xyz.com ) when we create virtual hosts in httpd-vhosts.conf. Instead we use xyz.dev or xyz.local as follows:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/xyz "
ServerName xyz.dev
ServerAlias xyz.dev
<Directory "c:/wamp/www/xyz">
AllowOverride All
Require local
</Directory>
</VirtualHost>

I wish to know if the folder xyz too must be named as xyz.dev or xyz.local instead of simply xyz, in which case ServerAlias won't be required?

Secondly on Windows 7, hosts file has # before "127.0.0.1 localhost" and "::1 localhost" as under. Should one remove the hashes or it doesn't really matter?:
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 xyz.dev
::1 xyz.dev

Thanks and Regards



Edited 3 time(s). Last edit at 01/15/2015 11:07AM by markIV.

Options: ReplyQuote
Re: confused about folder name and local name
Posted by: RiggsFolly (---.as43234.net)
Date: January 15, 2015 10:33AM

This is the line that tells apache where to get this site from
DocumentRoot "c:/wamp/www/xyz"

It has absolutely nothing to do with the domain name and could be coded as

DocumentRoot "c:/websrc/xyz-site/www"


This line tells apache more about the sites requirements
<Directory "c:/wamp/www/xyz">
And should match the DocumentRoot

ServerName xyz.dev
ServerAlias xyz.dev

ServerName and ServerAlias allow you to do this, for example

ServerName xyz.dev
ServerAlias www.xyz.dev

If they are coded exacly the same having the ServerAlias achieve very little or nothing



Second Question:

You should have this in your HOSTS file, plus any testing domains you create for yourself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 xyz.dev
::1 xyz.dev
So yes, remove those 2 #'s, they make the line a comment.

You should have an entry in the HOSTS file for each domain you want to create locally. Without an entry in here your invented testing domain names wont exist and your browser etc wont be able to find these domains when you use them in your browser address fields.

The HOSTS file is a bit like your own local DNS, its a hangover from before DNS Servers were invented. In those early days you had to remember the ip address of your favourite sites, so the HOSTS file was invented so you could give an ip address a name ( thats basically all DNS Servers do now ).

So for example in those days you might have had this in the HOSTS file

74.125.206.124  yahoo.com
89.31.144.147  wampserver.com

We now use this feature to allow us to create a domain name known only to us locally.

Some malware software use the HOSTS file to block access to bad sites and advertising networks, and put hundereds of the bad sites names in the HOSTS file and point them to 127.0.0.1 i.e. this PC, so you never get to them or see the adverts.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: confused about folder name and local name
Posted by: markIV (103.5.184.---)
Date: January 15, 2015 11:03AM

@RiggsFolly I am extremely thankful and grateful for such clear and detailed explanation.
My best wishes for you.

Options: ReplyQuote


Sorry, only registered users may post in this forum.