How do I use symbolic links in Apache/XAMPP? - apache

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

Related

Why do I get an error after changing the root directory of my XAMPP Apache server?

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>

403 you do not have permission

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?

Apache 403 error except from localhost

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.

Virtual host showing apache test page and everything else in doc root is forbidden

I am using a new CentOS 6.3 minimal install with fresh httpd installed
When I go to my virtual host it is showing me the apache test page, and then if I go to mydomain.co.uk/index.html (That I have just set up to test with) it says forbidden. All the usual answers to this don't seem to be working and I have honestly looked through tons of forums and other people questions/answers and nothing seems to be working for me.
I have created a group called 'www' that I have added the user 'apache' to.. This is my root directory in httpd.conf file, I have left it pretty open just for testing:
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
This is my vhosts file:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>
<VirtualHost *:80>
ServerName domain.co.uk
ServerAlias www.domain.co.uk
DocumentRoot /home/domain/public_html
<Directory "/home/domain/public_html">
Options Indexes FollowSymLinks ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
From /home/ onwards I have set the group to www
When ls -lA on home folder I get
drwxrwsr-x. 5 root www 4096 Feb 5 20:57 home
The error I am getting in my logs file is a permission one:
[Wed Feb 06 10:24:42 2013] [error] [client 62.254.7.226] (13)Permission denied: access to /index.html denied (filesystem path '/home/domain/public_html/index.html') because search permissions are missing on a component of the path
As is everything else in that folder. I really don't know what to try next. I have come to the point of needing to ask for my specific setup as following other tutorials or answers has not worked for me. Any help is greatly appreciated!
Error 13 means that the user/group specified in your apache configuration (httpd.conf) didn't have permission to access the files. The files, and all the directories above them, need to have permission that allow for that user and group.
One of the trickier bits can be extended permissions. If you are running selinux, the server user could be denied because of the extended permissions on the file. To check for this, run (from the command line):
setenforce 0
If the problem goes away (i.e. the page is visible) then your extended permissions are blocking access.
See http://wiki.apache.org/httpd/13PermissionDenied for details.
Selinux is not expecting the http server to access files under /home/domain since it is not a standard path.
You can change it with following command:
chcon -R --type=httpd_sys_rw_content_t /home/domain/public_html/

Setting up pow.cx to use Apache for PHP apps

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.