Setting-up localhost to other desired name on WAMP 2.4.9 server gets 404 Error - wamp

I want to rename my localhost server to other name, however I have encountered a 404 error. I have followed the steps how to set this up, But still I get error. I wonder what's wrong. I will provide the changes done.
c:\Windows\System32\Drivers\Etc\hosts.file
127.0.0.1 localhost
127.0.0.1 bluescript.com.ph
::89 localhost
::89 bluescript.com.ph
c:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhost.conf
I added the third host on the file
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName bluescript.com.ph
DocumentRoot "c:/wamp/www/bluescript/"
<Directory "c:/wamp/www/bluescript/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Under httpd.conf i did changed my port to 8989, since skype will use port 80
ServerName localhost:8989
#Listen 12.34.56.78:8989
Listen 0.0.0.0:8989
Listen [::0]:8989
I've already restarted WAMP and re-open the web browser and type url: http://bluescript.com.ph and get error: HTTP Error 404. The requested resource is not found. Where did i go wrong?

1) Remove these dummy (Example) Virtual Hosts that point to non existing folders
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
2)
If you must use a Non-Standard port number for Apache then that port number needs to be on the Virtual Host as well.
You should also add a Virtual Hosts for localhost
<VirtualHost *:8989>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:8989>
ServerName bluescript.com.ph
DocumentRoot "c:/wamp/www/bluescript/"
<Directory "c:/wamp/www/bluescript/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Also remember to remove the comment from httpd.conf to activate the httpd-vhosts.conf file
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Now restart Apache
And of course this means you must use the Non-Standard port number on all your urls. Like
http://bluescript.com.ph:8989
3)
Also this is wrong in your hosts file! Port number are not used in this file, so
::89 localhost
::89 bluescript.com.ph
Should be
::1 localhost
::1 bluescript.com.ph
After this change either reboot, or from a command window launched "As Adminitrator" do
net stop dnscache
net start dnscache

Related

Having Issue Adding Site to Local Host Virtual Host

Using WampServer 2.4.41 on Win64 Apache I am using this setting in my httpd-vhosts.confbust this is adding the maper as a new VirtualHost to the WampServer instead of adding it as Site into localhost:8080 VirtualHost
<VirtualHost *:8080>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#webematics
<VirtualHost *:8080>
ServerName maper
ServerAlias maper
DocumentRoot "${INSTALL_DIR}/www/maper"
<Directory "${INSTALL_DIR}/www/maper/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
I also have the hosts as
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 maper
As you can see the maper is listing on my projects but it is not click able and also I am getting this message
To use them as an http link, you must declare them as VirtualHost
What am I missing, and how can I fix this to put everything under one Virtual Host localhost?

Create vhost in wamp server

httpd.conf:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName localhost
DocumentRoot "C:/wamp/www/"
ErrorLog "logs/error.log"
CustomLog "logs/error-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin shop#angels
ServerName shop.angels
ServerAlias www.shop.angels
DocumentRoot "C:\wamp\www\magento"
ErrorLog "logs/ag-error.log"
CustomLog "logs/ag-error-access.log" common
<Directory /wamp/www/magento>
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
file host:
127.0.0.1 localhost
127.0.0.1 shop.angels
but when i visit shop.angels, it redirect to localhost/magento (default url), what is the error?
It all look pretty good but you could try changing these few lines
From
DocumentRoot "C:\wamp\www\magento"
To
DocumentRoot "C:/wamp/www/magento"
From
<Directory /wamp/www/magento>
To
<Directory "c:/wamp/www/magento">
This next bit is just to remove the possibility of you getting IPV4/IPV6 ipaddress issues later
From
Allow from 127.0.0.1
To
Allow from 127.0.0.1 localhost ::1
Or if you are using Apache V2.4.x change
From
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
To
Require local
You dont mention what version of WAMPServer or Apache you are using, if this last change causes an Apache error i.e. the ::1 ip address, then you are using an apache that does not yet understand IPV6, so you can leave off the ::1 address.
If you have correctly configurated vhost, then delete folder var/cache and then F5
my httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "c:/wamp64/www/sgtest"
ServerName sgtest.local.cz
<Directory "c:/wamp64/www/sgtest">
AllowOverride All
Require local
Allow from all
</Directory>
</VirtualHost>

WAMP server not running after enabling httpd-vhosts.conf

I tried enabling Virtual Host on my WAMP installation, but WAMP server will not run if I enable http-vhosts.conf, and the icon remains orange.
Here is my hosts file:
127.0.0.1 localhost
127.0.0.1 test.localhost
My httpd.conf:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
and my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/test"
ServerName test.localhost
</VirtualHost>
It works fine if I add the VirtualHosts to my httpd.conf, but I noticed that the Apache server will not run if I comment out "Include conf/extra/httpd-vhosts.conf". What is causing this issue?
Thanks,
To determine the exact line on which the error is occurring, take the following steps:
Go to start menu
type "cmd"
press enter
paste the following C:\wamp\bin\apache\apache2.2.22\bin\httpd.exe
Note: You may need to tweak the apache2.2.22 portion of the path according your local version of Apache.
OK I feel this my duty to put this...
I too went on a rampage of checking forms and doing things like
Listen *:80 & NameVirtualHost *:80 but found that this was not necessary, the default settings were fine for me.
the problem started when I tried to put in my vhost declaration
<VirtualHost 127.0.0.1>
DocumentRoot 'c:\wamp\www\media_weber_edu\public'
ServerName media.weber.dev
<Directory 'c:\wamp\www\media_weber_edu\public'>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<\Directory>
</VirtualHost>
here lied the problem
<\Directory> vs </Directory>
A huge help to finding this was running C:\wamp\bin\apache\apache2.2.22\bin\httpd.exe
this gave me an error like this
httpd.exe: Syntax error on line 469 of C:/wamp/bin/apache/apache2.2.22/conf/httpd.conf: Syntax error on line 42 of C:/wamp/bin/apache/apache2.2.22/conf/extra/httpd-vhosts.conf: Expected </\\Directory> but saw </VirtualHost>
So this may not be the exact problem but I hope this will help those in the future. So take a deep breath... glue the hair back on your head... its going to be ok :)
You just need to change it like as this: everything will be OK.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
# DocumentRoot "c:/wamp/www"
ServerName localhost
# ErrorLog "logs/localhost-error.log"
# CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
# DocumentRoot "c:/wamp/www/test"
# ServerName test.localhost
</VirtualHost>
If somebody has error of Directory, he may need to modify it like below:
<VirtualHost 127.0.0.1>
# DocumentRoot 'c:\wamp\www\media_weber_edu\public'
ServerName media.weber.dev
# <Directory 'c:\wamp\www\media_weber_edu\public'>
# Options Indexes FollowSymLinks MultiViews
# AllowOverride all
# <\Directory>
</VirtualHost>
notes: Apache does not allow multiple <Directory> arguments!

How can I set up multiple virtual hosts in httpd.conf and have each use a different .htaccess file?

I have many virtual hosts setup in my httpd.conf all set up like this:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "c:/wamp/wwwWP/"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName testing.local
DocumentRoot "c:/wamp/wwwtesting/"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName images.local
DocumentRoot "c:/wamp/wwwimages/"
</VirtualHost>
I have commented out the #DocumentRoot line from the file. Everything works fine in my setup, but I can't figure out how to use a .htaccess file on more than one of my virtual hosts at the same time. I seem to have to change this line to the site I'm currently working on each time:
<Directory "C:/wamp/wwwimages/">
It's getting a little obnoxious. How can I set up my apache to use a .htaccess file for any virtual host that has one?
Thanks!
Check this SF question:
https://serverfault.com/questions/203550/htaccess-is-ignored-even-though-virtualhost-has-allowoverride-all
Something along these lines should help:
<VirtualHost *>
ServerName intranet
DocumentRoot /var/www/default
<Directory "/var/www/default">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Also check this post:
https://serverfault.com/questions/173910/in-apache-does-the-htaccess-file-override-the-httpd-conf-for-mod-rewrites
<VirtualHost 127.0.0.1>
VirtualDocumentRoot c:/wamp/www%-2
</VirtualHost>

Wamp in LAN with a real domain name

I have domain name and I have set virtual host I want to know how to connect the domain name to my virtual host I'm new to this so plz answer easy understandable answers
http-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from localhost
</Directory>
</VirtualHost>
<VirtualHost example.com>
DocumentRoot "C:/wamp/www/example"
ServerName example.com
ServerAlias example.com
Options Indexes FollowSymLinks
<Directory C:/wamp/www>
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
I want to show the website using domain name internal and external
Ok so lets assume your domain is called mysite.com and you also need a testing version of the site, lets say mysite.dev
You have used Apache 2.2 syntax so I assume you are using a version of Apache that is 2.2.x, however if you are using Apache 2.4.x see below for correct syntax
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
<Directory "C:/wamp/www">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from localhost
</Directory>
</VirtualHost>
# This is for accessing a development version of the site
# note: only accessible from this machine
<VirtualHost *:80> <-- change
DocumentRoot "C:/wamp/www/mysite.test"
ServerName mysite.dev
<Directory "C:/wamp/www/mysite.test">
Options Indexes FollowSymLinks <-- moved
Order Deny,Allow
Deny from all
Allow from localhost 127.0.0.1 ::1
</Directory>
</VirtualHost>
#New Virtual Host for your real domain name
#accessible from the internet
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mysite.com"
ServerName mysite.com
ServerAlias www.mysite.com
<Directory "C:/wamp/www/mysite.com">
Options Indexes FollowSymLinks
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
If you are using Apache 2.4.x then the syntax should be chabged like so :-
#NameVirtualHost *:80 <- not required in apache 2.4
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
<Directory "C:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
# This is for accessing a development version of the site
# note: only accessible from this machine and stored in different folder
<VirtualHost *:80> <-- change
DocumentRoot "C:/wamp/www/mysite.test"
ServerName example.dev
<Directory "C:/wamp/www/mysite.test">
Options Indexes FollowSymLinks <-- moved
Require local
</Directory>
</VirtualHost>
#New Virtual Host for your real domain name
#accessible from the internet
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mysite.com"
ServerName mysite.com
ServerAlias www.mysite.com
<Directory "C:/wamp/www/mysite.com">
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
You will need to add the mysite.dev site to the windows HOSTS file c:\windows\system32\drivers\etc\hosts but NOT the live domain name
127.0.0.1 localhost
127.0.0.1 mysite.dev
::1 localhost
::1 mysite.dev