In my document root I have created a directory named error and some files inside it. Whenever I try to access localhost/error, I get 403 forbidden error. There is an unanswered question about the exact same problem. The error log for the error is as following
[Sun Aug 19 09:00:52.317995 2018] [autoindex:error] [pid 3536:tid 1592] [client ::1:61437] AH01276: Cannot serve directory F:/xampp/apache/error/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive
After seeing the log I came to know that the /error directory is appended to ServerRoot (F:/xampp/apache) instead of DocumentRoot (F:/xampp/htdocs). Apache is doing the above only for /error. It is working as expexted for other directories. Can someone tell me the reason and source of this problem?
Try changing the permission on the directory using chmod -R 777. I was facing the same issue and this worked for me
Related
I'm trying to setup a vagrant box with a lamp stack and was mostly successful. However, now I'm stuck with the error "Server unable to read .htaccess file". My setup is a Centos 7 server with Apache 2.4 and PHP 5.6.
Apparently, this seems to happen a lot as I saw many people ask that question, but here's the thing:
1) All my folders are with 777 permissions
2) AllowOverride all and Require all granted is set on all of my folders
3) Even went so far as to add apache user to root group just to see if it would change something
I basically did everything that was suggested in all of the posts I saw and still, apache can't read the .htaccess file.
In my logs, I see:
[Tue Sep 26 15:20:18.178541 2017] [core:crit] [pid 6491:tid 139938095892224] (13)Permission denied: [client 10.0.2.15:52176] AH00529: /var/www/html/Kalendho/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/html/Kalendho/public/' is executable
So I presume apache actually find the file, but for some reason, cannot open it even though it should be able to. So really, any help would be greatly appreciated as I'm currently at my whit's end here.
Thanks in advance
Okay, so apparently, it was an issue with selinux. Here's what I did:
Opened the file /etc/selinux/config and changed the following line:
SELINUX=enforcing
to
SELINUX=disabled
After that, I rebooted my machine and it got rid of the htaccess error.
When I try to run my website it shows a 500 internal server error :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster#example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Error log says :
[cgi:error] [pid 13006] [client 141.101.104.167:28335] AH01215: suexec policy violation: see suexec log for more details: /home/myweb/public_html/cgi-bin/index.cgi
[cgi:error] [pid 13006] [client 141.101.104.167:28335] End of script output before headers: index.cgi
And Suexec log says :
[2016-04-23]: uid: (500/myweb) gid: (500/myweb) cmd: index.cgi
[2016-04-23]: error: target uid/gid (500/500) mismatch with directory (500/500) or program (0/0) or trusted user (0/10)
Since the problem seems from suexec I decided to check at it, so in WHM/Configure PHP and suEXEC I found it's status On, I disabled it and try to run website again but nothing changes, I enabled it again but website still cannot running.
I went to /usr/local/apache/conf/httpd.conf and removed the directive :
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup myweb myweb
</IfModule>
</IfModule>
But that didn't solve the problem and the website still shows 500 internal server error
I changed te permission of /home/myweb/public_html/cgi-bin/ from 777 to 755 then to 775 but the problem still exist.
Can you help me to solve this problem.
change the permissions to 755 for all your files
and enjoy !
The problem is the un-appropriate permissions
On my local system i tried to get password protecting a directory with .htaccess running on Mamp 3.0.7.2 . The Apache version Mamp uses is Apache/2.2.29 (Unix). The httpd.conf file
/applications/mamp/conf/apache/httpd.conf
contains the following active line:
LoadModule authn_file_module modules/mod_authn_file.so
My testproject in
/applications/mamp/htdocs/sandbox/testproject/admin/.htaccess
contains following lines:
AuthBasic Basic
AuthName "Admin Area"
AuthUserFile /applications/mamp/htdocs/sandbox/.htpasswd
require valid-user
the .htpasswd file was created one level beneath in the sandbox folder for testing purpose only with:
htpasswd -c .htpasswd adminuser
with pwd .htpasswd within the sandbox folder i've extracted the exact path to prevent any typos which lead to
/applications/mamp/htdocs/sandbox/.htpasswd
but when i try to access the index.php file in the admin folder i get the following in the browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you#example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
and the php_error.log outputs the following on every try:
[Mon Dec 29 11:23:30 2014] [alert] [client ::1] /Applications/MAMP/htdocs/sandbox/testproject/admin/.htaccess: Invalid command 'AuthBasic', perhaps misspelled or defined by a module not included in the server configuration
But how could the AuthBasic command be misspelled or not included, cuz it actually is defined properly as shown above. :/
In my httpd.conf file, every mention of the ErrorDocument has a hash before it on the same line - meaning that it's commented out.
So why do I get a 404 error page on the browser? How does the browser know what message to display?
I must be getting a 404 because this is displayed in the error_log;
[Wed Jun 25 12:21:17 2014] [error] [client **********] File does not exist: /var/www/html/surveys/blahblah
Is there a default setting somewhere?
My environment is Linux, Apache and PHP
You see Apache httpd's simple hardcoded message.
You need to configure an empty document as the ErrorDocument if you want a empty page to be displayed.
See the Apache Documentation or this question for further informations.
I'm getting a 500 Internal Server Error when I add an .htaccess file to the root of my site on MAMP. I have a virtual host set up, so the site is accessable through site.dev and my files live in /Users/Dan/Websites/site. There isn't any .htaccess files above the my current directory. At first, I thought it was something going on inside of my file, but I removed everything except for a commented line and the error is still there. When I have a blank file, the error goes away.
Update: Here's the error log
[Mon Apr 01 11:17:18 2013] [alert] [client 127.0.0.1] /Users/Dan/Websites/site/.htaccess: Invalid command '\xff\xfe#', perhaps misspelled or defined by a module not included in the server configuration
Any ideas?
\xff\xfe is the byte-order marker (BOM) for UTF-16. There's nothing wrong with that but Apache doesn't seem to support BOMs at all. So you'll need to save your .htaccess file with a different encoding, either a single-byte one or UTF-8 without BOM.