in wamp setup, i am unable to set virtual host for my application.
Appache;
D:\wamp\bin\apache\apache2.2.8\conf\extra
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<VirtualHost 127.0.0.1>
DocumentRoot "D:/wamp/www/"
ServerName www.example.org
# ...
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot D:/wamp/www/facebook_post_style
ServerName www.example.net
ServerAlias *.example.net
# ...
</VirtualHost>
in host
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 www.example.org
127.0.0.1 www.example.net
I did above configuration. For both domain, same output is displaying.
please check this below URL.
try this
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\wamp\www\facebook_post_style"
ServerName www.example.net
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\wamp\www\FolderName"
ServerName www.example.org
</VirtualHost>
also make sure you have uncommented the following line from httpd.conf file
Include conf/extra/httpd-vhosts.conf
check this article for details
With below stuff virtual host worked Apache;
D:\wamp\bin\apache\apache2.2.8\conf\extra
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.localhost
#DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost"
DocumentRoot "D:/wamp/www/"
ServerName localhost
#ServerAlias www.dummy-host.localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.localhost
# DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
DocumentRoot "D:/wamp/www/facebook_post_style"
ServerName localhost1
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.localhost
# DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
DocumentRoot "D:/wamp/www/crop"
ServerName www.example.net
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
in host:
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 localhost1
127.0.0.1 www.example.net
click on the wamp icon in task bar > Apache > httpd.conf
enable below line
Virtual hosts
Include conf/extra/httpd-vhosts.conf
Related
You don't have permission to access / on this server.
I created a new virtual host for my project. And now I cant access all locally stored projects that I could access earlier. But project on virtual host works.
http-vhosts.conf:
<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#my_poject.com
DocumentRoot "c:\wampF\www\my_project\web"
ServerName my_poject.com
ErrorLog "logs/my_poject.com-error.log"
CustomLog "logs/my_poject.com-access.log" common
</VirtualHost>
hosts:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 my_poject.com
I think you are using Apache 2.4.
Use
Require all granted
instead of all
Order allow,deny
Allow from all
from your all .conf files
for eg-:http.conf, httpd-vhosts.conf, httpd-autoindex.conf like that.
Then restart your system.
Regds
Please help me setup correct configuration on apache server. I don't know what it is called but I want to setup multiple sites on my server (Amazon EC2 (CentOS) server). It doesn't have a domain name yet.
I have installed the required software including php (checked with phpinfo.php). It is working fine.
Now, I want to host two different php based sites on my machine.
Assume, my IP address is x.y.z.a
Directories :
/var/www/html/crm
/var/www/html/crmpanel
/var/www/html/mysite
In my httpd.conf, I have :
NameVirtualHost *:80
ServerName x.y.z.a
DocumentRoot "/var/www/html"
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName x.y.z.a
ServerAlias x.y.z.a
DocumentRoot "/var/www/html/crm"
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName x.y.z.a
ServerAlias x.y.z.a
DocumentRoot "/var/www/html/crmpanel"
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName x.y.z.a
ServerAlias x.y.z.a
DocumentRoot "/var/www/html/mysite"
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined
</VirtualHost>
If I run "httpd -S", it returns 'Syntax OK'. Apache server starts without any errors.
Please help me understand what is wrong in my configuration.
You need to set the ServerName and ServerAlias (Domain names instead of the ip) for corresponding virtual host entry and also the correct DocumentRoot .
The ServerAlias is optional .
ServerName : xyz.com
ServerAlias : www.xyz.com
please refer this blog post for detailed explanation .
please i need your help. I am working on a zend framework 2 project, the project's name in Wamp/www folder is pizza.
i tried to configure a virtual host on hosts file,httpd.conf and httpd-vhosts.conf to work with this project url: pizza.local/
instead of this: localhost:8080/pizza/public/
but something is not ght with my configuration.
note that I am using localhost:8080 not localhost.
Please help me to find what I did wrong. Here's my files:
httpd.conf:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
httpd-vhosts.conf:
<VirtualHost *:8080>
ServerAdmin webmaster#localhost.com
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias www.localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-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 *:8080>
DocumentRoot "c:/wamp/www/pizza/public"
ServerName pizza.local
<Directory "c:/wamp/www/pizza/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
hosts file:
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 pizza.local
127.0.0.1 localhost
As you are using this VHOST on port 8080. You need to mention in URL as below.
http://pizza.local:8080/
As i tried to configure my virtual host on apache(xampp) in windows7 - x64.
I put something like this,
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/projects/mysite/public"
ServerName www.mysite.com
ErrorLog "logs/www.mysite.com-error.log"
CustomLog "logs/www.mysite.com-access.log" common
</VirtualHost>
And in my hosts file (C:\Windows\System32\drivers\etc\hosts) i put something like this,
127.0.0.1 localhost
127.0.0.1 mysite.com
And i run it on the browser,
http://www.mysite.com -
Server not found
Firefox can't find the server at www.mysite.com.
Do i missed something to configure? Any ideas..
Your hosts file needs to be
127.0.0.1 localhost
127.0.0.1 mysite.com
127.0.0.1 www.mysite.com
Because mysite.com and www.mysite.com are not the same. I recommend add ServerAlias into your vhost.conf and change ServerName
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/projects/mysite/public"
ServerName mysite.com
ServerAlias www.mysite.com
ErrorLog "logs/www.mysite.com-error.log"
CustomLog "logs/www.mysite.com-access.log" common
</VirtualHost>
Try this..
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot "C:/xampp/htdocs/projects/mysite/public" #Make sure that your httpd.conf file has DocumentRoot set to your htdocs folder or the folder in which your site is in.
CustomLog logs/site.com.access.log combined
ErrorLog logs/site.com.error.log
</VirtualHost>
I cannot get PHP scripts to run in my Virtual Hosts. It works fine on the default host, but will not run in any other hosts. I've tried everything I could find on the web. Mac 10.8 Server.
#/private/etc/apache2/extra/httpd-vhosts.conf
Listen 80
Listen 8080
Listen 8010
NameVirtualHost *:80
NameVirtualHost *:8080
NameVirtualHost *:8010
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Library/Server/Web/Data/Sites/Gradschool"
ServerName gradschool.local
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "/Library/Server/Web/Data/Sites/PMST"
ServerName PMST.local
</VirtualHost>
<VirtualHost *:8010>
DocumentRoot /library/server/web/data/sites/test
ServerName test.local
</VirtualHost>
PHP could be disabled for the virtual hosts. Try enabling it with "php_admin_flag engine on":
<VirtualHost *:80>
DocumentRoot "/Library/Server/Web/Data/Sites/Gradschool"
ServerName gradschool.local
<Directory /Library/Server/Web/Data/Sites/Gradschool>
php_admin_flag engine on
AllowOverride AuthConfig FileInfo
Order allow,deny
allow from all
</Directory>
</VirtualHost>