Could anyone please help me with setting up this virtual host on my WAMP server?
I have read through several posts and blogs online and unable to get this set up.
I followed the procedure suggested here: http://www.ruifeio.com/2011/01/30/setting-up-virtual-hosts-on-wampserver/
When I do the above, my server hangs up. Presently I added the following to my C:/windows/system32/drivers/etc/hosts file
127.0.0.1 tsg.local
And I changed my httpd.conf Apache config file with Listen 90 since I am using Port 90
Plus, removed # tag as suggested in the above tutorial.
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
I also added the following to my httpd-vhosts.conf
<VirtualHost *:90>
ServerAdmin webmaster#localhost
DocumentRoot “C:\wamp\www\tsg\”
ServerName tsg.local
ErrorLog “C:\wamp\www\logs\tsg.log”
CustomLog “C:/wamp/www/logs/common.log” common
</VirtualHost>
And changed: NameVirtualHost *:80 to NameVirtualHost *:90
Thanks for helping out in advance!
If your server will start fine with the Virtual Host block removed, try fixing your quotes. It looks like you have some "magic quotes" instead of straight quotes - likely from copy and pasting from the tutorial. Try this instead:
<VirtualHost *:90>
ServerAdmin webmaster#localhost
DocumentRoot "C:\wamp\www\tsg\"
ServerName tsg.local
ErrorLog "C:\wamp\www\logs\tsg.log"
CustomLog "C:/wamp/www/logs/common.log" common
</VirtualHost>
You also might want to pick a more standard port to listen on, 8080 or 8888 rather than 90 if 80 is not an option.
Related
When attempting to access a website i am attempting to host on my pc using WAMP i get the typical error code 403 forbidden. I have edited the apache config to allow all etc but still seem to get it, however i can see localhost and phpadmin from 127.0.0.1
Any other suggestions? i can attach my apache config or put it in a pastebin if needed
For reference im running Win10(64x) with WAMP Server 3.0.6 (64x)
I have followed multiple tutorials from youtube and stackoverflow but cannot seem to get it to work as most use commands given are from linux such as 'chmd' (i have used linux before therefor understand what this means but cant work out how to do the same thing via windows)
Try making virtual host and give access to all local user. Make sure you give access to
file -------> httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
#onlineoffline tag - don't remove
Require local
Require ip 192.168.0
</Directory>
Edit httpd-vhosts.conf As like:
file ------> httpd-vhosts.conf
# Virtual Hosts
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName smarthome
DocumentRoot "c:/wamp64/www/smarthome"
<Directory "c:/wamp64/www/smarthome/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
from today, when I go to localhost (http://localhost) after launch WAMP, in Firefox, as usual, everything is normal, but Chrome says "Forbidden, You don't have permission to access / on this server."
Anyone can help me please ?
Edit: Solved it for me.
This is an IPv6 problem. Google must have just updated Chrome.
First of all ensure that your hosts file has the following line and that it is uncommented.
::1 localhost
Next, open up your Apache config (httpd.conf) and add the following to the listen section:
Listen [::1]:80
Next, you need to edit you Directory statements in httpd.conf or your vhosts files. They probably look something like this.
<Directory "C:\path">
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
AllowOverride All
</Directory>
Add an extra line after the 'Allow from 127.0.0.1' so it looks like this
<Directory "C:\path">
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
AllowOverride All
</Directory>
For anyone running into this problem this is what worked for me on apache 2.4.17
host file is here: C:\Windows\System32\drivers\etc
httpd.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf
httpd-vhosts.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf\extra
I made sure that localhost was enabled in my hosts file:
127.0.0.1 localhost
::1 localhost
just remove the # at the beginning of the line.
make sure this line in un-commented in your httpd.conf
Include conf/extra/httpd-vhosts.conf
In my file it was line 518.
then add this to your httpd-vhosts.conf file:
<VirtualHost *:80>
ServerAdmin somerandomdude#whaaat.com
DocumentRoot "c:/wamp64/www"
ServerName localhost
</VirtualHost>
Then restart WAMP.
I don't know if that's the cleanest way of doing it(probs not). but it worked pretty well for me.
It happens the same to me. From today I can not access with http://localhost to my wamp files with chrome.
In Firefox or Explorer I have no problems.
You can use 127.0.0.1 while the problem is solved.
I had the same problem. This is how I solved it out:
I first added ::1 to host file,usually found at C:\Windows\System32\drivers\etc
Then I went ahead an opened my Chrome browser. I went to settings>advanced settings>Open proxy settings (under the title system)
In the new window that pops up go to 'LAN settings' then make sure you check 'Automatically detect settings'
I have created subdomain in my DNS server. How can I set each subdomain so that it only accepts connections via a particular port?
For example: ftp.example.com → only accepts connections that come from port 21
You can set port restrictions using iptables.
You can also set port restrictions on the server itself and it depends on your server architecture. If you're running Apache, then you should take a look at defining a virtual host (vhost).
Just for illustration sake:
<VirtualHost *:21>
ServerAdmin webmaster#example.com
ServerName ftp.example.com
# Index + Directory root
DirectoryIndex index.php | index.html
DocumentRoot /var/www/path/to/site
</VirtualHost>
See that "*:21" - that's the port number.
Generally speaking, ftp.example.com would probably still redirect to your server's root directory.
How i can correctly direct multiple url in a same conf file.let me know if i am correct to put my conf file like this
<VirtualHost *:80>
ServerName domain1.com
ServerAlias domain2.com
... real vhost settings ...
</VirtualHost>
and what if user could'nt find the url then he should me directed to a default page.please if anyone can tell me how i can put a redirection to a defult only if that url is not found.
You can set up apache vhosts like this:
<VirtualHost *:80>
ServerName domain1.com
ServerAlias *.domain1.com
ServerAlias domain2.com
ErrorDocument 404 /errors/error404.php
#... real vhost settings ...
</VirtualHost>
Any not found URL will be redirected to /errors/error404.php, or any URL you give here.
Ref http://en.wikipedia.org/wiki/HTTP_404.
For ServerAlias domain2.com, you must set up first a bind primary zone for this domain in your name server, this cname will point to your server's IP, otherwise, this line will have no effect.
Some details
XAMPP 1.7.1
OS tested on vista and xp
Hello everyone. I have some problems with configuring my virtual hosts.
Currently I have two sites.
Here is my vhost.conf file:
<VirtualHost *:80>
ServerAdmin me#site.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me#site.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
And of course in my host file I have
127.0.0.1 site1.local
127.0.0.1 site2.local
I have restarted apache as well as my browser various times.
Here is my problem:
http://site1.local works. But when i go to http://site2.local, I land at site1.local.
any idea's?
Try
<VirtualHost "site1.local">
ServerAdmin spam#a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost "site2.local">
ServerAdmin spam#a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
You always get site1 because Apache default to the first.
edit
Uncomment
#NameVirtualHost *
to
NameVirtualHost *
In your httpd.conf
Mine says (/etc/httpd/conf/httpd.conf)
126 # Listen: Allows you to bind Apache to specific IP addresses and/or
127 # ports, in addition to the default. See also the <VirtualHost>
128 # directive.
129 #
130 # Change this to Listen on specific IP addresses as shown below to
131 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
132 #
133 Listen 127.0.0.1:80
134 NameVirtualHost 127.0.0.1
And my vhost file has
<VirtualHost "www.whatever.com">
DocumentRoot /var/www/html/whatever/pub
ErrorLog logs/error_log
ServerName www.whatever.com
...