Im setting up a localhost for the first time. I have something weird going on.
I running Fedora 24 with apache with the root folder at /var/www/html.
I have tested that this works by using vi to create an index.html which loads fine.
But now I have written some html and php files and moved them to the root dir.
Imediately I get 403 message. Log writes Out this:
[Tue Apr 04 16:06:52.116376 2017] [core:error] [pid 15260] (13)Permission denied: [client ::1:40686] AH00132: file permissions deny server access: /var/www/html/index.html
Now I create a test.html with sudo vi test.html and this file is able to load without a 403.
I then matched all the ownership and permissions to the file that loaded correctly.
And still nothing.
in the config file This stands out:
<Directory "/var/www">
AllowOverride None
Allow open access:
Require all granted
</Directory>
and:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Am i missing somthing here?
Related
Context
I'm trying to change the root directory of my XAMPP Apache setup. Currently, the root directory is /htdocs. My project folder is named "Real Website", so I want the root directory to be /htdocs/Real Website so that I can reference files using the root like I do on my live website (I have to add "Real Website" to the root reference [/Real Website/] before referencing a specific file on my localhost instead of just being able to use "/", like I do on my live server).
To accomplish this, I went into the httpd.conf file (XAMPP/xamppfiles/etc/httpd.conf). I edited the following lines from
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
to
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/Real Website"
<Directory "/Applications/XAMPP/xamppfiles/htdocs/Real Website">
I also edited the first directory tags to look as follows:
<Directory />
AllowOverride all
Require all granted
</Directory>
After going into a file in my "Real Website" folder after making these changes, I added the line window.location.href = "/" in JavaScript to see if it would display the "Real Website" folder. I got this error:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.46 (Unix) OpenSSL/1.1.1h PHP/7.4.12 mod_perl/2.0.11 Perl/v5.32.0
The URL simply shows "localhost", as well.
After checking the error logs, I got this further information:
[Mon Aug 09 00:21:55.011957 2021] [authz_core:error] [pid 78225] [client ::1:56063] AH01630: client denied by server configuration: /Applications/XAMPP/xamppfiles/htdocs/, referer: https://localhost/Real%20Website/index.php
Question
Any idea why I'm getting an "Access forbidden!" error after changing the root directory?
Things I've Tried
I changed the line "Require all denied" to "Require all granted", as shown below, to no avail (maybe these lines have no impact).
<Directory "/Applications/XAMPP/xamppfiles/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
Additionally, this is the config of the folder directory:
<Directory "/Applications/XAMPP/xamppfiles/htdocs/Real Website">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>
I also tried changing the file permissions on the "Real Website" folder to 777, which didn't work, either.
Could it have to do with the two-word folder name? Could the space between "Real" and "Website" be the issue? I was having trouble with this when trying to add something to .htaccess, so I'm wondering if it's a problem here, too.
Let me know if there are any questions.
if you want people to be able to access the 'real website' directory then you have to grant them access to that directory, something like this...
<Directory "/Applications/XAMPP/xamppfiles/htdocs/Real Website">
Require all granted
</Directory>
I have tried a number of suggestions/answers for similar problems but none have helped!
I am running an Apache2..4.7 on ubuntu 14.4, I've done
mkdir /var/www/html/download
cp src /var/www/html/download/file.extn
While the request localhost or 127.0.0.1 and surprisingly 127.0.1.1 are returning Ubuntu default page,
http://127.0.0.1/download/file.extn is giving
Forbidden
You don't have permission to access /download/file.extn on this server.
Apache/2.4.7 (Ubuntu) Server at 127.0.0.1 Port 80
Error log says:
(13)Permission denied: [client 127.0.0.1:52345] AH00035: access to /download/apkFile.apk denied (filesystem path '/var/www') because search permissions are missing on a component of the path
apache2.conf has been changed to:
Directory
Options FollowSymLinks
AllowOverride None
Require all granted
Directory
Directory /usr/share
AllowOverride None
Require all granted
Directory
Directory /var/www/
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Directory
Directory /var/www/html/download
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Directory
Permission to all directories leading to /var/www/html/download/file.extn has been chmod to 644.
When i try to connect to my WAMP server using anything but localhost i get error 403.
[Tue Sep 24 10:23:06.363000 2013] [access_compat:error] [pid 2912:tid 1520] [client ip:ip:ip:ip:49886] AH01797: client denied by server configuration: C:/wamp/www/
[Tue Sep 24 10:23:06.916000 2013] [access_compat:error] [pid 2912:tid 1520] [client ip:ip:ip:ip:49886] AH01797: client denied by server configuration: C:/wamp/www/favicon.ico
I tried to start the wamp services as my account (running on win7 x64). I tried to edit these lines in the httpd.config
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
but i still get the error.
EDIT: I installed an older version of WAMP (2.2E) and everything works fine not sure what's different in the newest version (2.4)
Change that section back to
Order Deny,Allow
Deny from all
That section controls access to your root drive and that should always be `Deny from all'
Look for this section of https.conf
# onlineoffline tag - don't remove
And change the section below that to
Allow from 127.0.0.1 ::1 localhost
Also make sure that your hosts file c:\windows\system32\drivers\etc\host has these entries
127.0.0.1 localhost
::1 localhost
EDIT:
You didn't actually say you were using WAMP 2.4. It would have helped:
In that case, read this thread, from the wampserver forum, it describes how to fix a bunch of 2.4 issues.
I am trying to link from the htdocs directory in my XAMPP directory to my home directory (I am using Ubuntu). The permissions of the directory of my website are drwxrwxr-x.
I also added the FollowSymLinks option for htdocs in httpd.conf:
<Directory "/opt/lampp/htdocs">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>
Nevertheless, I still get a error 403 when i try to open my website.
This is the message in error.log :
[Thu Dec 06 22:53:28.874813 2012] [core:error] [pid 7553] [client 127.0.0.1:32999] AH00037: Symbolic link not allowed or link target not accessible: /opt/lampp/htdocs/benjamin/website-paul
Do you have any idea what could be the reason?
You must identify where you want to allow from -- who is allowed to follow the link. This could be an IP, IP range, domain, or all. Also, even though you are likely to allow from all, it is good practice to set allow order.
Order allow,deny
Allow from all
I've set up Pow and Apache the way they suggest in this tutorial. My httpd-vhosts.conf contains the following entry.
<VirtualHost *:80>
DocumentRoot /Users/michael/Dropbox/Development/test
ServerName test.dev
<Directory "/Users/michael/Dropbox/Development/test">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I'm still getting a 403 Forbidden when I got to http://test.dev/.
Error log says:
[Wed Nov 21 19:24:21 2012] [crit] [client 127.0.0.1] (13)Permission denied: /Users/michael/Dropbox/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Wed Nov 21 19:24:43 2012] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
Has anyone else had this problem?
This seems to have nothing to do with Pow. Apache doesn't have the necessary permissions to work within /Users/michael/Dropbox/Development/test.
Please check the permissions of this directory, I think they should be 755. Check them with:
cd /Users/michael/Dropbox/Development/
ls -l
And copy paste the line of the test directory.
The issue was the permissions. It finally worked when I chmod'd the full path to the directory I was working in to 755.
~/, ~/Dropbox, ~/Development...etc.
I'll bet there's a nicer way to do this, but it's working. So, there you go.