Create vhost in wamp server - wamp

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>

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?

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

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

wamp vhost servername redirects to wamp homepage instead of the welcome page of CodeIgniter

I am a newbie in php using the framework codeigniter.
I want my servername to be directed to the welcome page of codeigniter.
And while setting up the vhost,
I had problems in vhost servername.
Everytime I access it, it redirects to the wampserver homepage.
I tried configuring it in the httpd-vhost.conf using this:
<VirtualHost 127.0.0.1>
DocumentRoot "C:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:/wamp/www/mysite"
ServerName mysite.com
</VirtualHost>
I uncomment the Include conf/extra/httpd-vhosts.conf line
I also included the domain name in windows host file.
127.0.0.1 mysite.com
But still, every time I access mysite.com, it shows the wampserver homepage instead of the welcome page of codeigniter.
You need to uncomment:
NameVirtualHost *:80
in httpd-vhosts.conf. Maybe even make it
NameVirtualHost *
Make sure to use FollowSymLinks
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
and even make two virtual hosts.. one for domain.com
<VirtualHost *:80>
ServerName domain.com
DocumentRoot C:/wamp/www/domain
ErrorLog C:/wamp/www/domain/logs/error.log
CustomLog C:/wamp/www/domain/logs/access.log common
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and again for www.domain.com
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot C:/wamp/www/domain
ErrorLog C:/wamp/www/domain/logs/werror.log
CustomLog C:/wamp/www/domain/logs/waccess.log common
<Directory "c:/wamp/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
be sure you've created all the folders for the log files.
And btw I'm not 100% sure all of this will work.
Good resources on this topic:
Wamp Server: Multiple Virtual Hosts are not working on Windows
http://www.dennisplucinik.com/blog/2007/08/16/setting-up-multiple-virtual-hosts-in-wamp/

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