Aid in setting up a Virtual Host with Wamp in Windows Vista - wamp

I need some help in setting up this thing.
I followed a tutorial about setting up a virtual host in WAMP which included the following steps:
Opened file httpd.conf in folder C:\wamp\bin\apache\apache2.2.6\conf and uncommented the last # of the following statement:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf"
to look like this:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Opened the file httpd-vhosts.conf in folder C:\wamp\bin\apache\apache2.2.6\conf\extra, deleted everything in there and replaced with these codes below:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.jagerseow.servegame.com (WHICH IS A DOMAIN A REGISTERED IN NO-IP)
ServerAlias jagerseow.servegame.com domain
DocumentRoot C:/wamp/www/MP4Public
ErrorLog "C:/wamp/www/MP4Public/logs/error.log"
CustomLog "C:/wamp/www/MP4Public/logs/access.log" common
</VirtualHost>"
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:/wamp/www
ErrorLog "C:/wamp/www/logs/error.log"
CustomLog "C:/wamp/www/logs/access.log" common
</VirtualHost>
Used Notepad to open file hosts in folder C:/Windows/System32/drivers/etc on server computer; then, deleted and replaced the default codes with these codes:
127.0.0.1 localhost
127.0.0.1 domain
Restarted WAMP and waited until it turned green, which it did ...
Try to connect to my server page by typing domain in the browser and my web page showed up normally. However when anyone, including myself, tries to open it by typing the address (http://www.jagerseow.servegame.com), no page is loaded.
I'm running Windows Vista 32-bit. Anyone can tell me what I'm doing wrong?

Change your Virtual Hosts definition to this:-
NameVirtualHost *:80
## must be first so the the wamp menu page loads
## and stray hacks get sent here and ignored because access
## is only allowed from local ips (127.0.0.1 localhost ::1 )
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.jagerseow.servegame.com
ServerAlias jagerseow.servegame.com
DocumentRoot "C:/wamp/www/MP4Public"
# changed, dont want your logs available under your docroot directory (security)
ErrorLog "C:/wamp/www/logs/MP4Public_error.log"
CustomLog "C:/wamp/www/logs/MP4Public_access.log" common
<Directory "D:/wamp/www/MP4Public">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>"
Now you need to change your hosts file to :-
127.0.0.1 localhost
127.0.0.1 jagerseow.servegame.com
After changing this do the following, or reboot.
Run a command window Run as Administrator and do
net stop "DNS Client"
net start "DNS Client"
This will force a refresh of the DNS Cache and make the new domain name available on your PC.
The hosts file is loaded by windows into its DNS cache. It pre-loads urls and is a bit like a very low function DNS. So this tell the dns cache and therefore your browser etc that jagerseow.servegame.com is found on ip address 127.0.0.1 which is this PC
If you actually did want the universe to be able to see this site, I assume you do as you used Allow from all, you will then have to port forward port 80 on your router to the ip address of the PC running wamp. Also that PC will need a STATIC ip address so it does not change when you reboot. Help for that can be found here PortForward.com

Related

Two domains in a single AWS ec2 instance

I have two domains domain1.com & domain2.com & want to run both domains on a single ec2 instance.
I have created 2 hosted zones for both domains and added nameserver in my domain provider.
domain1.com's code resides in - /var/www/html
domain2.com's code resides in - /var/www/domain2
Added virtual host for both respective domains in
/etc/httpd/conf/httpd.conf
virtual host looks like below:
<VirtualHost *:80>
ServerAdmin webmaster#yourdomain.com
DocumentRoot "/var/www/html"
ServerName domain1.com
</VirtualHost>
So when I run domain1.com that works perfectly fine, but when run domain2.com it show code from /var/www/html but it should show code from /var/www/domain2
So please help me to identify what I am doing wrong?
Give this a try:
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName www.domain1.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/domain2"
ServerName www.domain2.com
# Other directives here
</VirtualHost>
This will set up two VirtualHosts that respond to domain1.com and domain2.com, respectively. Note that the first VirtualHost for domain1.com will be seen as the primary host and will be the default responder for all requests that don't match any ServerNames.
Other examples can be found here.

VirtualHost with default IP address

i create new VirtualHost
<VirtualHost lar.local>
DocumentRoot "C:\\wamp\\www\\laravel\\public\\"
ServerName lar.local
ServerAlias lar.local
<Directory "C:\\wamp\\www\\laravel\\public\\">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
My host file:
127.0.0.1 localhost
127.0.0.1 lar.local
When i open - lar.local works fine.
But when i open default WAMP address (127.0.0.1), i get "C:\wamp\www\laravel\public\" also the same directory. Why?
Why with 127.0.0.1 i can't open root server directory (C:\wamp\www\) as before?
How fix this

How to debug virtual hosts in WAMP that don't seem to be working?

I'm trying to setup virtual host on my Windows machine. In my httpd-vhosts.conf file, I have this:
<VirtualHost *:80>
ServerAdmin admin#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/blg"
ServerName blg.com
</VirtualHost>
When I go to http://localhost, I see all the folders under c:/wamp/www, so that looks fine. However, when I go to http://blg.com, I expect to see the files in c:/wamp/www/blg, but I don't. Instead, I am seeing exactly what localhost sees: the files in c:/wamp/www. What's wrong with my setup?
Apache has a fallback when a virtual host is not configured properly. It runs the FIRST Virtual Host it sees in your list of virtual hosts i.e. localhost in your case.
Your VHOST definitions are a bit lacking in content, and as you do not mention that you created an entry in the HOSTS file to match your blg.com domain that also could be one of your problems.
Check this post out, as part of it it describes how to setup a Virtual host properly.

Wamp Virtual Host Set Up

sorry for having a similar question to what has been posted all ready but the others aren't helping me.
I'm trying to set up a virtual host on my windows 8 computer but I can't seem to get it to work no matter what tutorial or help section i follow, this is my setup so far.
httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config
Listen 80
<VirtualHost *:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Program Files (x86)\2. Apps\Wamp\www"
ServerName localhost
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Users\Chris\Documents\Projects\testsite\Site"
ServerName testingsite
ServerAlias testingsite
<directory "C:\Users\Chris\Documents\Projects\testsite\Site">
Options Indexes FollowSymLinks
Order Allow,Deny
Allow from all
</directory>
</VirtualHost>
hosts
# Wamp Server Settings
127.0.0.1 localhost
127.0.0.1 testingsite
httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
If i try to start wamp the icon goes orange.
If i run httpd.exe from command prompt i get the following error:
C:\Program Files (x86)\2. Apps\Wamp\bin\apache\apache2.4.2\bin>httpd.exe
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : AH00072: make_sock: could not bind to address [::]:80
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : AH00072: make_sock: could not bind to address 0.0.0.0:
80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
I read that another program might be blocking it or my firewall but i don't know how to fix it, any ideas?
Thanks
Thanks for everyone's input, there were two main problems
I installed wamp into a folder which was nested in a folder who's name had a space in so c:/folder/folder with a space/wamp/ which i have since been told is bad practice, if anyone knows why please tell.
The were issues with the internet protocol, namely ipv6, so solve this you need to ensure wamp only uses ipv4, inside httpd.conf find Listen 80 and change to Listen 0.0.0.0:80. Again i'm not sure what this does so if anyone knows please post below.
I hope this helps anyone else stuck.

Virtual Host with WAMP

I'm using Wamp 2.2, edited conf/extra/httpd-vhosts.conf edited this file to add VirtualHosts , but when I un-commented line in httpd.conf to include httpd-vhosts.conf file, after restarting Wamp doesn't starts. If I revert changes is works fine.
Any ideas why is this happening?
This is code I'm using in httpd-vhost.conf:
<VirtualHost *>
ServerAdmin admin#localhost.com
DocumentRoot "C:/wamp/www" # change this line with your htdocs folder
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# WooCommerce Multisite
<VirtualHost dev.lo>
ServerAdmin admin#localhost.com
DocumentRoot "C:/wamp/www/dev"
ServerName dev.lo
ServerAlias dev.lo
<Directory "C:/wamp/www/dev">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks
George
Edit
As Andreas Hagen suggested, I run Apache via httpd.exe.
First error was wrong parameter for DocumentRoot, as appears comment like was taken as second parameter, when DocumentRoot accepts only one.
Then I got warning: [warn] NameVirtualHost *:80 has no VirtualHosts. Did a quick search and found very helpful question - https://serverfault.com/questions/1405/apache-2-startup-warning-namevirtualhost-80-has-no-virtualhosts
Probably some bad config in vhosts file. Try to start apache from commandline so you get the error output. That will help you identify your problem.
Open your hosts file (\WINDOWS\system32\drivers\etc\hosts).
Add this line to the bottom:
127.0.0.1 test
This will tell your computer that any url that contains test will be routed to 127.0.0.1 (localhost).
Now open httpd.conf and add this to the very bottom of the file:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/myfirstsite/"
ServerName testsite
</VirtualHost>
Now restart apache and navigate to: http://test/ (you may have to restart your browser for the changes to take effect.)
Hope this works.
Go to C:/drive and choose wamp folder
and go to C:\wamp\bin\apache\Apache2.4.4\conf and choose httpd.conf file.
Edit with notepad and go to 58 line number
change Listen 80 and replace Listen 8181 Save file and restart your Apache server
Now check url such like this localhost:8181
I have used this hop you will be success.