Localhost and subdomains
Posted 06 November 2005 - 12:06 AM
Now I need 2 things:
1. Changing my main localhost root folder from c:\apache\htdoc\north to c:\apache\htdoc. Is it enough to edit the httpd.conf file to contain:
DocumentRoot "C:/apache/htdocs", or are there other files needed to change?
2. Being able to access different websites on my home computer, using subdirectories like c:/apache/htdocs/north and C:/apache/htdocs/south etc. I've tried everything I could imagine and all I get is the infamous and sickening 404 finger!
P.S. I'm using Dreamweaver 2004. If there are special considerations, do enlight me.
Posted 06 November 2005 - 12:55 AM
Here is the layout.
In the httpd.conf file, at the very buttom right before these 2 last lines
LoadModule php4_module c:/php/sapi/php4apache.dll
AddType application/x-httpd-php .php
NameVirtualHost 127.0.0.1 Listen 127.0.0.1:80 <VirtualHost 127.0.0.1> ServerName main.com ServerAlias main DocumentRoot C:/apache/htdocs </VirtualHost> <VirtualHost 127.0.0.1> ServerName website_1.com ServerAlias website_2 DocumentRoot C:/apache/htdocs/website_1 </VirtualHost> <VirtualHost 127.0.0.1> ServerName website_2.com ServerAlias website_2 DocumentRoot C:/apache/htdocs/website_2 </VirtualHost>
The first of the three sections must be present before the others, as this sets up the root of the localhost (I guess). The others can just be multiplied for as many times as you have websites in need of care.
Remember to stop Apache, and then restart it, for the changes to take effect.
And last, for the ones using Dreamweaver:
For each new site, set Site Definition like this:
Server model: PHP MySQL
Testing Server Folder: C:\apache\htdocs\website_1\
URL prefix: http://localhost/website_1/
Hope somebody else can have good use of this. It took me about 10 hours of research and too many cigarettes, but that is all behind me now. I'm a happy man.
Posted 06 November 2005 - 01:34 AM
Posted 06 November 2005 - 02:46 AM
By using the IP: 127.0.0.1 you are enclosing yourself to localhost access only. Other users who attempt to access your computer won't be able to use the subdomains
Yes you're right, and that was also the idea. I'm not running a server myself, and I don't want anyone to access my computer. I just wanted a setup, so I could locally maintain different websites, and then easily upload the from Dreamweaver.
If there is a catch in that aspect, do let me know.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users