Checked almost stackoverflow answers but getting same error, using windows server 2012 installed XAMPP( Apache/2.4.33 (Win32) OpenSSL/1.0.2o PHP/5.6.36 ).
xampp does not access any project from htdocs other than xampp dashboard.
Error :
httpd-vhost.conf :
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/mysite"
ServerName local.yourdomain.com
<Directory "C:/xampp/htdocs/mysite">
Require all granted
</Directory>
</VirtualHost>
hosts :
127.0.0.1 localhost
127.0.0.1 local.yourdomain.com
httpd.conf :
DocumentRoot "C:/xampp/htdocs/mysite"
<Directory "C:/xampp/htdocs/mysite">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
I have found that these 403 errors are (almost) always Apache configuration errors. Unfortunately there is not a lot of diagnostics in the logs for this.
Try this in your httpd-vhosts.conf file:
<VirtualHost *:80>
ServerName example.local
DocumentRoot "C:\Users\shipl\htdocs\example"
<Directory "C:\Users\shipl\htdocs\example">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Your hosts then would have:
127.0.0.1 localhost
127.0.0.1 example.local
Note that 'example.local' and '\htdocs\example' must be consistent in all the references.
Hope this helps.
Related
im trying to open my wamp server with my android device but i get "android you don't have permission to access / on this server" apache version is 2.4.18.i tryed to modify httpd.conf but it doesnt work.Now its like this:
DocumentRoot "c:/wamp64/www"
<Directory "c:/wamp64/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Allow from all
</Directory>
I hope you can help me
For newer versions of WampServer (3.0+) you do not need to two things :
1) Modify the file httpd.conf
Go to directory where wamp is installed eg
C:\wamp64\bin\apache\apache2.4.23\conf and edit the following :
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options +Indexes +FollowSymLinks +Multiviews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
#onlineoffline tag - don't remove
Require all granted
Edit Require none to Require all granted
2) Now go to C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vhost.conf and do the same change to the Virtual Host defined for localhost
AllowOverride All
Require all granted
Restart the server it should work
I'm trying to setup virtual hosts on my localhost, below are the things that I've done:
Enable Virtual Hosts
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Created Virtual Hosts
# localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# Pendu Web
<VirtualHost *:80>
ServerName local.mysite
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite”
<Directory "/Applications/XAMPP/xamppfiles/htdocs/mysite">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/mysite.local-error_log"
</VirtualHost>
Edit Hosts File
# XAMPP VirtualHost mappings
127.0.0.1 local.mysite
Now, when trying to access local.mysite from browser url, gives back Error 404: Object Not Found. When checking apache error log, the error is Warning: DocumentRoot [/Applications/XAMPP/xamppfiles/htdocs/mysite\xe2\x80\x9d] does not exist. Not really sure what I'm missing here.
The problem was caused by this DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite”, the closing double ( ” ) quotation mark, updated it to ( " ).
My Problem
I've tried many methods, I've researched a ton of questions on StackOverflow and none of them work! Some info:
I'm running Snow Leopard OS X (10.6.8)
I'm using XAMPP
Apache is loading the default (backup) directory. (See bottom of question for what I mean)
Attempt of solving
Here are the websites I've tried:
Adding VirtualHost fails: Access Forbidden Error 403 (XAMPP) (SO)
Xampp vhosts do not work (SO)
Apache Virtual Host is not working right (SO)
Apache VirtualHost not working (SO)
virtual host not working - Apache Web Server forum at WebmasterWorld
Additional Info
My VirtualHosts File:
<VirtualHost wrks.tk:80>
DocumentRoot "/Apps/XAMPP/htdocs/DNS"
ServerName wrks.tk
ErrorLog "/Logs/wrks.tk-error.log"
CustomLog "/Logs/wrks.tk-access.log" common
<Directory "/Apps/XAMPP/htdocs/DNS">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
What it's actually loading (This is the defualt directory in the httpd.conf file, the "backup" directory):
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
Couple of things I'd check are:
Making sure you include the httpd-vhosts.conf
# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Set up hosts:
navigate to Macintosh HD/private/etc/hosts, in a text editor and click Open. Then add this line:
127.0.0.1 wrks.tk
And maybe try:
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/DNS"
ServerName wrks.tk
ErrorLog "/logs/wrks.tk-error_log"
CustomLog "/logs/wrks.tk-access_log" common
</VirtualHost>
You may also want to set up localhost again.
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
ServerName localhost
</VirtualHost>
Sorry if some of these paths aren't accurate, you will need to check them against your xamp folder structure.
The simplest implementation I found is this:
http://iwearshorts.com/blog/adding-a-virtual-host-vhost-in-xampp-on-a-mac/
I'm trying to setup apache virtual host on Mint linux. It kinda works, but some images are not available. For example http://test.local/icons/world.png returns 404 even if image exist. When I check log it says it's looking for image at /usr/share/apache2/icons/world.png even if I setup my DocumentRoot to /var/www/test.local/public_html
This is how I did this. copy /etc/apache2/sites-available/default to test.local and edit like this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName test.local
DocumentRoot /var/www/test.local/public_html
<Directory /var/www/test.local/public_html/>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Then I edit /etc/hosts and include 127.0.0.1 test.local in it. Run a2ensite test.local and restart apache.
What I try to do is map folder in my /var/www/test.local/public_html to http://test.local is there anything I'm missing, or easier way to do this.
Also to mention there is no .htaccess file in root directory of project, or in icons directory.
RESOLVED :)
This is 2nd time I'm answering my own questions here on SO. I actually was researching 2 days and found answer few hours after posting here.
Answer was that this is default Apache alias
Alias /icons/ "/usr/share/apache2/icons/"
Even if I couldn't find it in apache2.conf or in conf.d directory, it looks like it's there in /etc/apache2/mods-available/alias.conf under my Mint distribution (I guess all Debian distro will have similar path). All I needed to do is to comment out this alias and it works.
I have installed zendserver and it is running on http://localhost:81/.
Now I have created zend framework 2 project in Apache2/htdocs/zend2 and accessing this through http://localhost:81/zend2/public.
I have to set virtual host for this like zend.local but it is not working.
In httpd.conf file
NameVirtualHost *:81
<VirtualHost *:81>
<Directory "C:\Program Files/Zend/Apache2/htdocs/zend2/public">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
DocumentRoot C:\Program Files/Zend/Apache2/htdocs/zend2/public/
ServerName zend.local
ServerAlias zend.local
</VirtualHost>
and In hosts file
127.0.0.1 zend.local
I have tried all possibilities but nothing works.
I recommend installing ubuntu for development i dont see how your doing it on windows and how it doesn’t annoy you.
try this:
make a copy of the default portion and just add ServerName Zend.local then modify the paths and that should work. You might also want to try restarting the computer that sometimes makes it work (rare occasions)
here is a copy of mine that works but its under ubuntu so it might or might not work for you.
<VirtualHost *:80>
#ZEND-{354B5BC7F803049AB79DE95C47F32B59}
Include "/usr/local/zend/etc/sites.d/zend-default-vhost-80.conf"
#ZEND-{354B5BC7F803049AB79DE95C47F32B59}
ServerAdmin webmaster#localhost
ServerName zendapp.dev
DocumentRoot /var/www/vhosts/zendapp/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/vhosts/zendapp/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
#ZEND-{90331A19916187EEA0C9B3A8FE0E1632}
Include "/usr/local/zend/etc/sites.d/globals-*.conf"
Include "/usr/local/zend/etc/sites.d/vhost_*.conf"
#ZEND-{90331A19916187EEA0C9B3A8FE0E1632}