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!
Related
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
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>
so I use Debian 6.0.9 (squeeze).
I have my project that I coded locally, that I uploaded on my server in /home/project/
now I already have mysql, apache2.2.16 and a lot of different PHP websites hosted.
Here's a typical sites-enabled/* I use :
<VirtualHost *:80>
ServerName project.com
ServerAlias www.project.com
DocumentRoot /var/www/project.com/htdocs/
</VirtualHost>
I installed wsgi mod and tried following what it says here https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/
and nothing works. I don't get how it could work anyway since I don't precise the URL I want to use for my project. The Documentation is really not clear... Anyone have a clue what I am supposed to do?
Edit : I forgot to write how my file looks like:
<VirtualHost *:80>
ServerName project.com
ServerAlias project.com
DocumentRoot /var/www/project.com/htdocs
WSGIScriptAlias / /home/project/project/wsgi.py
<Directory /home/project/project>
Order allow,deny
Allow from all
</Directory>
Alias /robots.txt /var/www/project.com/htdocs/robots.txt
Alias /favicon.ico /var/www/project.com/htdocs/favicon.ico
Alias /images /var/www/project.com/htdocs/images
Alias /static /var/www/project.com/htdocs/static
ErrorLog /var/www/project.com/logs/error.log
CustomLog /var/www/project.com/logs/access.log combined
</VirtualHost>
In your VirtualHost def:
Make sure you configure:
DocumentRoot, WSGIScriptAlias - configured properly is a MUST
ErrorLog, CustomLog - it helps in debugging
WSGIDaemonProcess and WSGIProcessGroup - is a good security practice
For example:
WSGIPythonHome PATH_TO_YOUR_PYTHON
<VirtualHost *:80>
ServerName project.com
ServerAlias www.project.com, *.project.*
ErrorLog "/var/log/httpd/vhost_test_error.log"
CustomLog "/var/log/httpd/vhost_test_access.log" combined
WSGIDaemonProcess project processes=2 threads=15 display-name=%{GROUP} python-path=PATH_TO_YOUR_VIRTUAL_ENV
WSGIProcessGroup project
#DocumentRoot /var/www/project.com/htdocs/
DocumentRoot "/var/www/project.com/PATH_TO_DJANGO_PROJECT"
WSGIScriptAlias / /var/www/project.com/PATH_TO_DJANGO_PROJECT/wsgi.py
</VirtualHost>
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/
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>