Vhost can't find server - apache

I am following RiggsFolly answer, on this question and these examples and so far everything went well, but when I click on the vhost FF says that it can't find the server. How can this fixed?
I am using Wampserver 2.5.
I get this in the adress bar : http://www.cakeprebuild.com/
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /wamp/www/CakePreBuild
ServerName www.CakePreBuild.com
<Directory "c:/wamp/www/CakePreBuild">
AllowOverride All
Require local
</Directory>
</VirtualHost>
hosts
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 CakePreBuild
::1 localhost
::1 CakePreBuild

Try these changes
Your VHOSTS Definition
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/CakePreBuild"
ServerName cakeprebuild.com
ServerAlias www.cakeprebuild.com
<Directory "c:/wamp/www/CakePreBuild">
AllowOverride All
Require local
</Directory>
</VirtualHost>
Your HOSTS file
127.0.0.1 localhost
127.0.0.1 cakeprebuild.com
::1 localhost
::1 cakeprebuild.com
Personally I would avoid using the .com tld for sites your are developing and use something like .dev.
If a site actually existed called cakeprebuild.com having added that name to the HOSTS file would mean you would never be able to access the actual live site from this PC as you have redirected it to this PC.

I'm guessing wamp is not configured correctly for your vhost. FF (and chrome to a lesser degree) will try and help you out add the
'http://www.' and '.com'
around what you entered, if what you entered didn't return a result. Turn off wamp and type in 'localhost', you'll be redirected to
http://www.localhost.com

Related

Xampp Apache 2.4 VirtualHost not working

I have xampp with apache 2.4 on windows 10.
i have this configuration in my C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site3/web"
ServerName site3.localhost
ServerAlias www.site3.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2/web"
ServerName site2.localhost
ServerAlias www.site2.localhost
</VirtualHost>
I added in my hosts file:
127.0.0.1 site2.localhost
127.0.0.1 site3.localhost
127.0.0.1 www.site2.localhost
127.0.0.1 www.site3.localhost
When i browse http://site2.localhost i see xampp root index.
When i browse http://site3.localhost i see again xampp root index.Same with www.site2.localhost...
What am I doing wrong?
A quick bit of info on Virtual Hosts. If you set one up and when you try and use it it sends you to the first Virtual Host, normally localhost it means there is something wrong with the Virtual Host definition or the HOSTS file, or you have entered the url incorrectly.
Apache will use the first VH defined in the file as the default site.
First remove these 2 lines from the HOSTS file
127.0.0.1 www.site2.localhost
127.0.0.1 www.site3.localhost
The HOSTS file should look like this
127.0.0.1 localhost
127.0.0.1 site2.localhost
127.0.0.1 site3.localhost
::1 localhost
::1 site2.localhost
::1 site3.localhost
Now each Virtual Host definition should also include some access rights like this
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site3/web"
ServerName site3.localhost
ServerAlias www.site3.localhost
<Directory "C:/xampp/htdocs/site3/web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2/web"
ServerName site2.localhost
ServerAlias www.site2.localhost
<Directory "C:/xampp/htdocs/site2/web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

wamp server put online for anyone to access

Hi ive been attempting to set up a wamp server so people can access it for testing
everything works correctly on my pc and i believe i have everything set up correctly but noone can connect to the site as it cant be reached
i have opened port 80 on my router and my firewall
my hosts file is as follows
127.0.0.1 localhost
::1 localhost
127.0.0.1 bandicam.com
127.0.0.1 ssl.bandisoft.com
127.0.0.1 btcGame.local
::1 btcGame.local
my httpd-vhosts.conf is as follows
#
# Virtual Hosts
#
<VirtualHost *:80>
DocumentRoot "g:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "G:/wamp/www">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName btcGame.local
ServerAlias www.btcGame.local
DocumentRoot "c:/wamp64/www/btcgame"
ErrorLog "logs/btcGame-error.log"
CustomLog "logs/btcGame-access.log" common
<Directory "/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
is there any other things i need to change in order to get my website online?
Other people trying to access your computer should know where to look.
Your server should then be referenced in the hosts file of their machine, except that IP should be resolvable such as
your.local.ip btcGame.local

Wamp localhost editing send me to WAMPSERVER Homepage

I want to change the adress of my website from http://localhost/tests/home.html
to www.mywebsite.com.
I edited the following files as explained :
C:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
C:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf
C:\Windows\System32\drivers\etc\hosts
However, i'm not redirected to home.html but to the Wamp Server Homepage.
Any idea on how to solve this ? For info, here's my httpd-vhosts.conf and hosts file.
<VirtualHost *:80>
ServerName www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 www.mywebsite.com
::1 localhost
::1 tests
::1 www.mywebsite.com
Also, note that there are more than one files in my www/tests folder, but i want to access to home.html specifically.
You also need a VH definition fot localhost when you create virtual hosts
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
And the Server name should be mywebsite.com with a ServerAlias if you want to use the www.www.mywebsite.com
<VirtualHost *:80>
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Hosts file changes
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 mywebsite.com
::1 localhost
::1 tests
::1 mywebsite.com
Once these are chnaged, remember to reset the dnscache
net stop dnscache
net start dnscache
And the restart Apache to pick up these chnages
wampmanager -> Apache -> Restart Service

How to set a local domain with XAMPP on Windows?

This is the changes made by me in httpd-vhosts.conf file
The code for the localhost
<VirtualHost *>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
The code for my domain:
<VirtualHost *:800>
ServerAdmin postmaster#myshop.local
DocumentRoot "D:\ampp\htdocs\myshop.local\www"
ServerName myshop.local
ServerAlias www.myshop.local
<Directory "D:\xampp\htdocs\myshop.local">
Order allow,deny`enter code here`
Allow from all
</Directory>
</VirtualHost>
I need to use myshop.local instead of localhost!!!
So in hosts i did the following but still can't access it through any
browser:
127.0.0.1 localhost
127.0.0.1 myshop.local
127.0.0.1 www.myshop.local

WAMP missing localhost in URL

Hoping to catch the attention of user RiggsFolly (or any knowledgeable person) as I am having issues getting the virtual hosts list to appear as described here: http://forum.wampserver.com/read.php?2,127757
My hosts file:
127.0.0.1 localhost
127.0.0.1 testing
::1 localhost
::1 testing
My http-vhosts file:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/testing"
ServerName testing
<Directory "c:/wamp/www/testing">
AllowOverride All
Require local
</Directory>
</VirtualHost>
I have uncommented the "Include conf/extra/httpd-vhosts.conf" line in the http.conf file. I stopped and restarted the dnscache, and restarted and refreshed the wamp service several times. I have added the ';WAMPVHOSTSUBMENU' line in the right place in the wampmanager.tpl file.
Basically I followed the guide to the letter and the list of vhosts just won't appear. I know that I am not alone in this issue, I can see others with it out there but I cannot find a solution.
Any help appreciated.