Vhost access error / wamp - windows

I have a big problem with my vhost installation with my wamp server when i want to load my website, it display this :
"Forbidden
You don't have permission to access / on this server."
i have seen a lot of tutorials and i have try this, and it didn't work well :
in : C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName panierdesaison79
DocumentRoot c:/wamp64/www/panierdesaison79/
<Directory "c:/wamp64/www/panierdesaison79/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
require all granted
</Directory>
</VirtualHost>
#
In : C:\Windows\System32\drivers\etc\hosts
#blablabla
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 panierdesaison79
::1 panierdesaison79
How it couldn't work?

Related

Apache2 setup macOS Monterey error Forbidden

I'm looking for a way to use multiple DocumentRoots on the local Apache server of MacOs Monterey. localhost works very well but for the other locations I have an error "Forbidden You don't have permission to access this resource."
I tried to use VirtualHost but it doesn't work
httpd.conf
ServerName localhost:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Require all granted
</Directory>
Include /private/etc/apache2/other/*.conf
extra/httpd-vhosts.conf
# Virtual Hosts
Listen 80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin example#example.com
DocumentRoot "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur"
ServerName iut.local
# ServerAlias iut
ErrorLog "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur/crash_log/Error"
CustomLog "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur/crash_log/Custom" common
<Directory "/Users/TooikLeChevalier/Documents/IUT/S3/Prog-Web-Serveur">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin example#example.com
DocumentRoot "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev"
ServerName eclypsegames.local
ErrorLog "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev/crash_log/Error"
CustomLog "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev/crash_log/Custom" common
<Directory "/Users/TooikLeChevalier/Documents/Perso/EclypseGames/Local_Dev">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
../hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 iut.local
127.0.0.1 eclypsegames.local
I have enclosed with you all the documents that could be useful in solving my problem.
Thanks in advance for your help

xampp and virtual hosts not working properly

my virtual host setup looks like this:
<VirtualHost *:8080>
ServerName localhost
DocumentRoot "D:\xampp\htdocs"
<Directory "D:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerName mysite.site
DocumentRoot "D:\xampp\htdocs\mysite"
SetEnv APPLICATION_ENV "development"
<Directory "D:\xampp\htdocs\mysite\public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and the hosts file:
127.0.0.1 localhost
127.0.0.1 mysite.site
but it actually doens't work. I have to go through localhost/mysite/public to make it work. Why? Instead of getting my site it loads my localhost default site which is xampp's htdocs folder.
EDIT:
Just wanted to add that I have Include conf/extra/httpd-vhosts.conf in httpd.conf already.
Ok, i finally got this. Looks like my port was incorrect. I checked what port is used in httpd.conf under ServerName localhost:80. Then I fixed my virtual host setup:
<VirtualHost *:80>
ServerName mysite.site
DocumentRoot "D:/xampp/htdocs/mysite/public"
SetEnv APPLICATION_ENV "development"
<Directory "D:/xampp\htdocs/mysite/public/">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now it works. :)

Laravel 5.2 site on localhost/Wamp

I am trying to learn Laravel.
I created a project on c:/sites where I develop all my sites. I called it larabasic.dev
I cannot open the site in my browser, it keeps switching to www.larabasic.dev and tells me server not found.
I set up a virtual host like I did to all my other sites that works well.
I tried:
1. Changing server.php to index.php and copied the public/htaccess file to the root folder
2. Going to http://larabasic.dev/public
3. Going to http://larabasic.dev/public/index.php
4. Changing vhosts file to:
<VirtualHost *:80>
ServerName larabasic.dev
ServerAlias larabasic.dev
DocumentRoot "c:/sites/larabasic.dev/public"
<directory "c:/sites/larabasic.dev/public">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
Instead of:
<VirtualHost *:80>
ServerName larabasic.dev
ServerAlias larabasic.dev
DocumentRoot "c:/sites/larabasic.dev"
<directory "c:/sites/larabasic.dev">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
My hosts file has these 2 entries:
127.0.0.1 larabasic.dev And
::1 larabasic.dev
Nothing helps. Again, any other sites I have developed with plain php work fine.
What am I missing?
Thank you
I've encountered the same problem and I've fixed this by giving 127.0.0.2 to my laravel application.
First, in the hosts file, you need to redirect larabasic.dev to 127.0.0.2:
127.0.0.2 larabasic.dev
Second, you need to bind the virtual host to that IP:
<VirtualHost 127.0.0.2:80>
DocumentRoot "C:/sites/larabasic.dev/public"
ServerAdmin admin#localhost
ServerName larabasic.dev
ServerAlias www.larabasic.dev
<Directory "C:/sites/larabasic.dev/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
# if you want access from other pc's on your local network
#Require ip 192.168.1
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>
This is my working configuration on my local machine.

MAC OSX: Cannot run multiple local domains

i am trying to add another local domain to my mac osx:
No matter what i do when visiting say 'domainnumber2.dev' it always displays the first host in my list.
If i swop them around in my httpd-vhosts file then i get the domainnumber2.dev site.
How can i run multiple localhost site on my mac.
I have a simple set up as below:
<VirtualHost *:80>
ServerName mydomain.dev
ServerAlias mydomain.dev
DocumentRoot "/Users/UserName/Sites/mydomain/"
</VirtualHost>
<VirtualHost *:80>
ServerName mydomainTwo.dev
ServerAlias mydomainTwo.dev
DocumentRoot "/Users/UserName/Sites/mydomainTwo/"
</VirtualHost>
I have also had the more details set up adding the below for both
<Directory "/Users/UserName/Sites/mydomain/">
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
In my hosts file i have:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 mydomain.dev
127.0.0.1 mydomainTwo.dev
which ever VirtualHost is first is the site that is served up
I stumbled across this same problem...
In your httpd-vhosts.conf file (/private/etc/apache2/extra/httpd-vhosts.conf after showing hidden files) add the following for each domain...
<VirtualHost *:80>
ServerName mysubdomain.dev
CustomLog "/root/to/site/logs/mysubdomain.dev-access_log" combined
ErrorLog "/root/to/site/logs/mysubdomain.dev-error_log"
DocumentRoot "/root/to/site/mysubdomain.co.uk"
<Directory "/root/to/site/mysubdomain.co.uk">
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Then restart apache. Everything else you have seems to be the same as my setup.
Make sure you have the correct permissions to be able to write the log files etc too.

After adding vhosts definiation xamppfiles/htdocs is invisible on http , but still accessible through https

I have vhost like this:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName local.testing.com
DocumentRoot "/Users/myname/Sites/myapp"
DirectoryIndex index.html
<Directory /Users/myname/Sites/myapp>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
hots files
127.0.0.1 localhost
127.0.0.1 local.testing.com
::1 localhost
after enabling this vhost , i am unable to access any of the sites under xampp/htdocs through http. But they are accessible through https
when I access localhost it shows directory listing for :"/Users/myname/Sites"
plz help me sort out this issue ,
thanks in advance
so the issue was that we need a virtual host for localhost e. g like this SOQ
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
ServerAlias localhost
ServerName localhost
</VirtualHost>

Resources