I created a new folder in public/ (in a laravel porject running on apache2) I set the permissions to 777 but apache keep having this error when I try to acceed to the folder with my browser : "You don't have permission to access this resource."
I'm using ubuntu for the OS. Here is my apache configuration file :
<VirtualHost *:80>
ServerAdmin contact#wewatch.fr
DocumentRoot /var/www/html/public/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Related
I am trying to upload my laravel project on aws by installing ubuntu. I pretty much already installed everything I have to but after writing .conf inside the sites-available, and reloading the apache2.service. There is an error indicating that the ServerAdmin is misspelled.
domain.conf
<VirtualHost *:80>
SeverAdmin ...#gmail.com
ServerName domain.com
SeverAlias www.domain.com
DocumentRoot /var/www/domain/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/domain>
Require all granted
AllowOverride All
Options Indexes Multiviews FollowSymLinks
</Directory>
</VirtualHost>
Sorry about that everyone! That was a simple spelling mistake
OS: Microsoft Windows 10
backend framework: Laravel
my goal: when I access to "http://example.domain", it can direct to laravel index.php.
httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs\NKUST_foodpanda\public"
DirectoryIndex index.php
ServerName example.domain
ErrorLog "C:\Apache24\logs\error.log"
CustomLog "C:\Apache24\logs\access.log" combined
<Directory "C:\Apache24\htdocs\NKUST_foodpanda\public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I save httpd-vhosts.conf and restart my apache, and now, when I access to "http://example.domain", it will direct to "C:\Apache24\htdocs", not "C:\Apache24\htdocs\NKUST_foodpanda\public".
I have tried with same possible scenario as yours with following entry httpd-vhost.conf. Checked it with both '' and '/' and it is working for me. Make sure to provide proper permission to your directories. If this could not work you need to provide more info.
<VirtualHost example.domain:80>
DocumentRoot "C:\Apache24\htdocs\NKUST_foodpanda\public"
DirectoryIndex index.html
ServerName example.domain
ErrorLog "C:\Apache24\logs\error.log"
CustomLog "C:\Apache24\logs\access.log" combined
<Directory "C:\Apache24\htdocs\NKUST_foodpanda\public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
If you want to set a newer setup in "httpd-vhosts.conf", you have to delete comment out "Include conf/extra/httpd-vhosts.conf" in "httpd.conf".
I have not notice this problem, I comment out "Include conf/extra/httpd-vhosts.conf" and set something in "httpd-vhosts.conf" at the same time, so "httpd-vhosts.conf" doesn't work.
I have a virtual host configure in my httpd-vhosts.conf, and when i enable (uncommented) virtual hosts on httpd.conf and try to access localhost or any link inside local that is not configured in v-host, always show me Forbidden You don't have permission to access this resource.
(httpd-vhosts.conf)
<VirtualHost *:80>
ServerName workshop.test
ServerAlias www.workshop.test
DocumentRoot "C:/Apache24/htdocs/workshop/workshop_app/public"
ErrorLog "logs/workshop.test-error.log"
CustomLog "logs/workshop.test-access.log" common
</VirtualHost>
(httpd.conf)
Include conf/extra/httpd-vhosts.conf
Add this within your workshop.test vhost block:
<Directory "C:/Apache24/htdocs/workshop/workshop_app/public">
DirectoryIndex index.php
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>
I am experiencing a problem when uploading laravel 8 to the service, it is only recognizing the "/" route and nothing else, then I am receiving the following error "The requested URL was not found on this server."
However if I indicate "domain/index.p/route", then it works normally, I saw several articles indicating that it was on apache2 in the .conf file but I couldn't configure it in case I'm using debian on EC2.
How could I be solving this issue?
.conf file
<VirtualHost *:80>
ServerAdmin webmaster
DocumentRoot /var/www/directory/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/directory>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName foo.localhost
DocumentRoot "C:/xampp/htdocs/foo/public"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName bar.localhost
DocumentRoot "F:/bar/public"
</VirtualHost>
When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.
Edit: Thanks! For future reference, add 'Options indexes' within to show directory indexes.
You did not need
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
the only thing what you need is...
Require all granted
...inside the directory section.
See Apache 2.4 upgrading side:
http://httpd.apache.org/docs/2.4/upgrading.html
Somewhere, you need to tell Apache that people are allowed to see contents of this directory.
<Directory "F:/bar/public">
Order Allow,Deny
Allow from All
# Any other directory-specific stuff
</Directory>
More info
For Apache 2.4.2: I was getting 403: Forbidden continuously when I was trying to access WAMP on my Windows 7 desktop from my iPhone on WiFi. On one blog, I found the solution - add Require all granted after Allow all in the <Directory> section. So this is how my <Directory> section looks like inside <VirtualHost>
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
I have fixed it with removing below code from
C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf 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>
And added
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
And it has worked like charm
Solved 403: Forbidden when visiting localhost. Using ports 80,443,3308 (the later to handle conflict with MySQL Server installation)
Windows 10, XAMPP 7.4.1, Apache 2.4.x My web files are in a separate folder.
httpd.conf - look for these lines and set it up where you have your files, mine is web folder.
DocumentRoot "C:/web"
<Directory "C:/web">
Changed these 2 lines.
<VirtualHost *:80>
ServerAdmin webmaster#localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
to this
<VirtualHost *:80>
ServerAdmin webmaster#localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Require all granted
</Directory>
</VirtualHost>
Add your details in your hosts file
C:\Windows\System32\drivers\etc\hosts file
127.0.0.1 localhost
127.0.0.1 project1.localhost
Stop start XAMPP, and click Apache admin (or localhost) and the wonderful XAMPP dashboard now displays! And visit your project at project1.localhost