403 Access Forbidden Error - php

I have two directories, using the first directory of (/var/www/html), my page is displaying perfectly after I include an index.html file. Then I created a second directory (/home/xsol/website) and created another index.html file. However, for the second directory, you will see a 403 forbidden error on the page even after I have given a chmod -r 755 to that file. My httpd.conf file is as below
<Directory "/home/xsol/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Try chmod -R 755 on the /home/xsol directory and add these settings to your new dir
Order allow,deny
Allow from all
Require all granted

Related

How to enable .htaccess in apache2 (ubuntu 18.04)

I'm trying to use .htaccess on my project on apache2 using ubuntu 18.04.
The tutorials I saw said that I have to change apache2.conf as:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
To:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all denied
</Directory>
After change it, I make my own htaccess on project but it doesn't work.
I want browser prevent user to go backward and browsing project directories and my computer directories using URL ../../../../
Ex: localhost/project/index.php/../../../../
How can I use my .htaccess in my project?, knowing that there is no default .htaccess file !
And how to prevent user for browsing directories using ../../ in url ???

Forbidden: You don't have permission to access /abcd/ on this server

I am running a CentOS 6.9 OS. I have Apache/2.2.15 (CentOS) Server running. I have a cakephp 2 application that I want to run here. I have an index.php file inside /var/www/html that runs perfectly. I have another folder called test inside /var/www/html.
Inside that folder there is an index.php file. Test folder also runs perfectly. But whenever I try to run the cakephp application from the browser I get the message I don't have permission to access that folder. The cakephp application has 0777 permission. Inside my /etc/httpd/conf/httpd.conf file there is written -
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
So I don't know what I am doing wrong and what more I can do.
hi dude please find and edit httpd.conf file, which is in /etc/httpd/conf/httpd.conf. and paste the code below
<Directory "/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
<Directory "/home/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
Then kindly restart the server if the problem still appear
disable the seLinux in /etc/selinux/config change SELINUX=disabled and restart the server it again hope it works now ^_^
restorecon -r /var/www/html does the job
I got the answer from here. https://www.centos.org/forums/viewtopic.php?t=6834

403:You don't have permission to access /index.php on this server

I'm facing the following message when I visit my website:
You don't have permission to access /index.php on this server.
I am able to visit my other website in same URL, as in http://xiukun.wang/scrapy/, but http://xiukun.wang/datavis/ doesn't work.
I have tried many methods to solve it, like editing my httpd.conf file, however it doesn't work. How do I solve it?
<Directory "/alidata/www">
AllowOverride none
Require all granted
</Directory>
DocumentRoot "/alidata/www"
<Directory "/alidata/www">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
Have you changed anything in your .htaccess file? Also did you change anything in config file such as DB name user and pass?
Also update the permissions to 755 of your public_html.
EDIT
Since you specified its apache, try these solutions:
Can you open your APACHE config file and find out the index name?
Check your Directive DirectoryIndex and make sure your index is listed, or else upload:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
Check for correct dir permissions:
<Directory "/home/domain/www">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
Modify file system permissions of Home directory that APACHE is
installed:
#chmod a+x /apache-home-dir-of installation
Make sure the CGI script requested have executable permissions set on
files. Use chmod command to set permission:
$ chmod +x file.cgi
Check APACHE logs for errors:
# tail -f /path/to/apache/error.logs
Source: https://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/

Local Host forbidden error and htaccess issue

I have spent a lot of time and read for the whole day to use htaccess in local host (Ubuntu).
I have folowed below steps.
1) Remove the '#' symbol from the line "AccessFileName .htaccess" File
: /etc/apache2/apache2.conf
2) changed, File : /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
to
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
3) Created a folder at the path /var/www/machine and placed two file index.html and demo.html
created a file .htaccess and the content of it is,
DirectoryIndex demo.html index.html
So, when I try to open the path localhost/machine it opens 'index.html' instead of "demo.html".
Also, when I have changed "AllowOverride None" to "AllowOverride All", I got a "you don't have permission to access localhost" error.

access forbidden xampp in mac php

there is the error infomation:
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.12 (Unix) OpenSSL/1.0.1m PHP/5.6.8 mod_perl/2.0.8-dev Perl/v5.16.3
I have setting httpd.conf file as follw:
Alias /myspace "/volumes/myspace/workspace/phpworkspace"
<Directory "/volumes/myspace/workspace/phpworkspace">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
#Require all granted
</Directory>
"/volumes/myspace/workspace/phpworkspace" this place is my location of code. I have tried many methods:
Xampp Access Forbidden php
New xampp security concept: Access Forbidden Error 403 - Windows 7 - phpMyAdmin
I have solve the problem .
in file "httpd.conf",there has another default Directory configuation like follow:
<Directory />
AllowOverride none
Require all denied
</Directory>
you can delete this directory or change is as follow:
<Directory />
AllowOverride all
Require all granted
</Directory>
The Order directive should be Allow first, then Deny.
Set Allow from all and don't set anything for Deny.
Change your Directory directive to this and it should work
<Directory "/volumes/myspace/workspace/phpworkspace">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
#Require all granted
</Directory>

Categories