virtual host setup in xampp, won7 - apache

I install XAMPP(OS : win 7 ) in D drive. Document root is D:/xampp/htdocs
When I open localhost/xampp/ then it open . No problem
I create virtual host zf2.local as bellow and it's working fine.
<VirtualHost zf2.local:80>
ServerAdmin webmaster#localhost
DocumentRoot "D:/xampp/htdocs/WORK/zend/public"
ServerName zf2.local
</VirtualHost>
But when I configure like bellow then it's show forbiden
<VirtualHost zf2.local:80>
ServerAdmin webmaster#localhost
DocumentRoot "D:/WORK/zend/public"
ServerName zf2.local
</VirtualHost>
Actually I want to set document root outside the htdocs & both should work means localhost as well as virtual host. please help me.

<VirtualHost *>
ServerAdmin admin#localhost.com
DocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folder
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Read this article for further help

This should solve your problem:
<Directory "D:/WORK/zend/public">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
OR
<Directory "D:/WORK/zend/public">
Allow from all
Require all granted
</Directory>

Related

Multiple Virtual Hosts not working

I am trying to set up two virtual hosts for one IP address say xxx.yy.xxx.yyy
I have my files on /var/www/html/folder1 and /var/www/html/folder2
I am adding VH like :
DocumentRoot /var/www/html/folder1
ServerName xxx.yy.xxx.yyy/folder1
AllowOverride All
DocumentRoot /var/www/html/folder12
ServerName xxx.yy.xxx.yyy/folder2
AllowOverride All
As I am new on CentOS7 Apache, can't figure out how to solve it.
I do not know if I can be helpful but I locally configure so apace to have multiple domains
<VirtualHost q4y.aurecchia.dev:80>
DocumentRoot "C:\xampp\htdocs\QuestManager\AurQuest4You\public"
ServerAdmin q4y.aurecchia.dev
<Directory "C:\xampp\htdocs\QuestManager\AurQuest4You">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost csm.aurecchia.loc:80>
DocumentRoot "C:\xampp\htdocs\CSM TEST\Aur_CSM\public"
ServerAdmin csm.aurecchia.loc
<Directory "C:\xampp\htdocs\CSM TEST\Aur_CSM">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

you don't have permission to access / on this server. apache 2.4

I'm having the problem
you don't have permission to access / on this server. apache 2.4
while accessing my local web site. I already googled a lot and read a lot of posts here in StackOverflow and everything seems to be correct.
This is my apache version:
Server version: Apache/2.4.27 (Unix)
Attached my httpd.conf file.
Here is my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost.smatchme.com
DocumentRoot "/Users/samuelrabini/Project/SmatchMe/smatchme.web"
ServerName localhost.smatchme.com
<Directory /Users/samuelrabini/Project/SmatchMe/smatchme.web>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
DirectoryIndex index.php
ErrorLog "/private/var/log/apache2/localhost.smatchme.com-error_log"
CustomLog "/private/var/log/apache2/localhost.smatchme.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.piuproduct.com
DocumentRoot "/Library/WebServer/Documents/piuproduct/public"
ServerName localhost.piuproduct.com
<Directory /Library/WebServer/Documents/piuproduct>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog "/private/var/log/apache2/localhost.piuproduct.com-error_log"
CustomLog "/private/var/log/apache2/localhost.piuproduct.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost.b2b.com
DocumentRoot "/Library/WebServer/Documents/b2b.tony"
ServerName localhost.b2b.com
<Directory /Library/WebServer/Documents/b2b.tony>
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/localhost.b2b.com-error_log"
CustomLog "/private/var/log/apache2/localhost.b2b.com-access_log" common
</VirtualHost>
Can anyone help me understand what I'm doing wrong?
I'm trying to access my site via http://localhost.b2b.com/
And I added in the /etc/hosts the entry:
127.0.0.1 localhost.b2b.com
thanks in advance
Samuel

apache virtual host not working for laravel app on digitalocean IP

I have create virtual host, but not working I am using digitalocean IP
<VirtualHost *:80>
ServerName ip/laravelblog
ServerAlias www.ip/laravelblog
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/laravelblog/public
#/etc/apache2/sites-available/laravelbog.conf
<Directory /var/www/html/laravelblog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
000-default.conf is also enabled and laravelblog also.
my url is ip/laravelblog ( I am using digitalocean IP). when I access my url (ip/laravelblog). its show all laravel folder. I need to point direct public folder.
I have solved the problem.
<VirtualHost *:80>
#ServerName
ServerAlias IP
Alias /project1 /var/www/html/project-path/public
Alias /project2 /var/www/html/project-path/public
DocumentRoot /var/www/html
<Directory "/var/www/html/>
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
the url will be IP/project1
for other project IP/project2
So you can add more and more Alias on one IP

XAMPP Windows Apache vhosts not redirecting properly

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
<Directory "C:/xampp/htdocs/">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/gl"
ServerName gl.dev
<Directory "C:/xampp/htdocs/gl">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
The above is what I currently have in my vhosts file. When I hit localhost I want my root to open, but when I load gl.dev I want the individual site to open. Any ideas?
hosts file:
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 gl.dev
I think in windows you have to use backslash when specifying document root. please try the following
<VirtualHost *:80>
ServerName localhost
ServerAlias *.localhost
DocumentRoot "C:\xampp\htdocs\"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName gl.dev
ServerAlias *.gl.dev
DocumentRoot "C:\xampp\htdocs\gl"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart WAMP server

Apache vhost not working for subdomains

I have this configuration but both url app.test.com & stage.test.com
redirect to same code/deployment
<VirtualHost *:80>
ServerName app.test.com
DocumentRoot /var/www/html/Test-Prod/web
<Directory "/var/www/html/Test-Prod/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-prod__error_log
CustomLog logs/test-prod_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName stage.test.com
DocumentRoot /var/www/html/Test/web
<Directory "/var/www/html/Test/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-website_error_log
CustomLog logs/test-website_access_log common
</VirtualHost>
The usual error for this is leaving out the NameVirtualHost directive if you're still using httpd 2.2
Add the following in your config file and it'll probably work
NameVirtualHost *.80
You might want to read the documentation for Named-based Virtual Host Support with httpd 2.2.
NameVirtualHost *.80
<VirtualHost localhost:80>
ServerName color
ServerAlias localhost
ServerPath "C:/wamp/www/subwww/color"
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www/subwww/color">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
in above code, subdomain name is color
and the url is http://color.localhost/
if the operating system is windows then add "127.0.0.1 color.localhost" in "C:/windows/system32/dirvers/etc/hosts" with notepad run as administration