Portal Home > Knowledgebase > Articles Database > setting up apache


setting up apache




Posted by cyjetsu, 07-14-2008, 04:57 PM
I have read apache docs. I have entered document root: # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" DocumentRoot "C:/operator1/oex-onmedias/primary" So now apparently, when I type "myurl" in my browser, it would display C:/operator1/oex-onmedias/primary/index.html, but it does not work! Why? Another question, how would I then be able to browse my actual website on my web host after I have uploaded it to my online server if the url is the same? it would only take me to the local server. Last question, how would I set up multiple local websites on apache? Do I need to do a new apache install for each website? Or if not, how do I divide doc-root urls and domains of multiple sites in my config file?

Posted by simonapnic, 07-14-2008, 05:42 PM
First of all, remove the DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" entry. To browse your website "online", just upload the content in your web directory that is configured for your webhost (usually /var/www/html if you are the only one that's being hosted on the machine). Consult your provider for more information about this. For hosting multiple websites, you'd use what's called 'virtual hosts'. Here's a guide on how to do it in a Windows environment: http://johnbokma.com/windows/apache-...-hosts-xp.html And on *NIX: http://www.serverwatch.com/tutorials...le.php/1127571

Posted by YUPAPA, 07-15-2008, 05:43 AM
Please look up name-based hosting

Posted by cyjetsu, 07-15-2008, 12:58 PM
I have followed some steps for setting up virtualhost but I have had no success. in file: c:\program files\apache software foundation\apache2.2\conf\httpd.conf i added(at end of file): Include conf/virtual-hosts.conf in same folder i created file "virtual-hosts.conf" and added in file: # Use name-based virtual hosting. NameVirtualHost 127.0.0.1:80 ServerName lc.onmedias.com DocumentRoot "C:\operator1\oex-onmedias\primary" CustomLog logs\lc.onmedias.com.access.log combined ErrorLog logs\lc.onmedias.com.error.log then in c:\windows\system32\drivers\etc\hosts, file i added: 127.0.0.1 localhost 127.0.0.1 lc.onmedias.com i restarted all apache services. so i thought when i enter in my browser, url: lc.onmedias.com, it should display websie from local(C:\operator1\oex-onmedias\primary) but i only get some default advertising website online. i was told to use 127.0.0.1 as default ip, i changed them to my computer ip address i looked up online and changed all ips to that, but still dosnt work. what am i doing wrong?

Posted by whmcsguru, 07-15-2008, 06:02 PM
It takes a lot more than just setting up apache to be able to run a server. Understanding how things work is pretty imperative too. 127.0.0.1 is a local address, nothing more. If you want nobody else to access your website, then point the DNS for that website to 127.0.0.1 and setup the configuration for apache to use that ip. The httpd configuration manual is pretty straightforward when it comes to how thins are done and how they're handled. Re-read it, because you'll need to understand what's what here. make sure that the ip you're pointing the domain to is the ip that it is pointed to in apache as well.

Posted by cyjetsu, 07-15-2008, 06:17 PM
thanks for the reply. i only want to test my website locally. i actually have a webhost i am paying for. the reason i am setting up local apache is to test my website while i am developing it locally on my computer, without having to upload it to my server to test it. mainly becuase i use root links and then later i will be experimenting with php. i am pretty close to getting what i need now: i am not quite sure how, but using another tutorial i used slightly different file placements with the same thing and an added: Order Deny,Allow Allow from all and now it seems to work but i can only seem to be able to load 1 website. i have in my virtualhosts file: ServerName lc.onmedias.com DocumentRoot "C:/vhosts/onmedias" CustomLog logs/lc.onmedias.com.access.log combined ErrorLog logs/lc.onmedias.com.error.log ServerName lc.viadesign.com DocumentRoot "C:/vhosts/viadesign" CustomLog logs/lc.viadesign.com.access.log combined ErrorLog logs/lc.viadesign.com.error.log when i use my browser and type url's: localhost, lc.onmedias.com, and lc.viadesign.com, will all only load the C:/vhosts/onmedias website....... however if i comment out all the onmedias virtual host, then they will all only load the other one(viadesign). for a second, they both would load the correct different sites but then after a refreshing my browser a couple of times, they BOTH went back to only loading 1 of them again and now they seem stuck there. I am unsure how to further divide or differenciate the 2 so they load the correct one.....any ideas?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read