No permissions on htaccess file - apache

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.

Related

How to run apache as non-root, using non-standard ports?

I need to get apache running as a non-root user, listening to port 8443, in order to have a new website available (on localhost:8443) for internal security scanning, on a CentOS 7.3 system. I understand only the basics of apache (on Ubuntu), and I am NOT a web administrator, so am unfamiliar with the many options / config settings necessary to get this to work.
I have a directory (/webcontent) with my website content (which requires php), and can host there the various conf files necessary. But I am stumbling through getting httpd.conf setup properly for apache to run as a local user, launched with:
httpd -f /webcontent/conf/httpd.conf
And have set the logs to write to /webcontent/logs (via ErrorLog parameter), but it then complains about not having write access to /run/httpd, and so won't actually start:
[Thu Feb 23 11:59:51.289587 2017] [auth_digest:error] [pid 25464]
(13)Permission denied: AH01762: Failed to create shared memory segment
on file /run/httpd/authdigest_shm.25464
I imagine this is only the first of many problems I might have to get this running, so if anyone can point out the specific config settings necessary in httpd.conf (or elsewhere?) to get this scenario to work, that would be very much appreciated. Or has any other suggestions on running a non-root instance of apache for testing.
A bit late, but I see there's no answer so far. I just ran into this issue myself. My solution is below.
Use the DefaultRuntimeDir directive to override the default "/run/httpd" directory. This goes in httpd.conf. For example:
DefaultRuntimeDir "/my/local/rundir"
This will cause apache to create "/my/local/rundir/authdigest_shm.1234"
For some reason this doesn't also override the default pid file directory, so set it with the PidFile directive, e.g.:
PidFile "/my/local/rundir/httpd.pid"
You might also want to look at the ServerRoot directive.

gitorious gives permission denied on fresh bitnami setup , amazon ec2 instance using https

This is a brand new installation of a bitnami gitorius image on EC2, worked fine until i tried to enable https/ssl.
I am sure i have misconfigured apache somehow, however the root document at https://tarantula.anatexis.net loads just fine.
but if one goes to the gitorious app at https://tarantula.anatexis.net/gitorious you get permission denied.
which config file do I edit to allow https traffic to gitorious.
looking at the apache logs, is see this,
[Mon Jun 03 17:25:20 2013] [error] [client 71.17.13.29] Directory index forbidden by Options directive: /opt/bitnami/apache2/htdocs/gitorious/, referer:Https://tarantula.anatexis.net/
Any help would be appreciated, Thanks
Joe
OK, so i fixed it, found the file /opt/bitnami/apache2/conf/extra/httpd-ssl.conf this config file has the document root in it for ssl traffic, the default is wrong and it needs to be changed to
DocumentRoot "/opt/bitnami/apps/gitorious/htdocs/public"
This solved all my issues I believe.

Can't run any file named install.php on localhost due to apache's access_compat

I'm getting a weird problem here.
I have at least 30 localhost WordPress installs made before and every one of them went fine.
Now (after re-installing Win7 and XAMPP) I can't access ANY install.php file (whether it's WPs own, a dummy empty one, etc). Also, it doesn't matter where it's located (wp-admin folder, a random place outside WP, htdocs root folder, etc).
This is not an antivirus or Windows firewall problem.
It seems to be coming from apache itself.
The apache error log says this
[Fri Nov 30 16:46:40.223524 2012] [access_compat:error] [pid 5876:tid 1604] [client ::1:59365] AH01797: client denied by server configuration: D:/xampp/htdocs/vmf05/wp-admin/install.php
Does anyone have a clue on this?
I've went through all the normal steps and haven't found a solution yet.
Also, if I disable the access_compat module, apache won't start.
Thanks in advance for your help.
I can't believe what the problem was!
I moved a .htaccess file that had the WP better security directives to the root of xampp's site as a backup, and forgot to move it back after.
No install.php file ANYWHERE could be accessed since it had the following:
<files install.php>
Order allow,deny
Deny from all
</files>
And, since the file was on the root, it was affecting the whole server.

Setting up a virtual host on LAMP (Ubuntu 11) returns 403

i am having problems with setting up a virtual host (Aptana Project directory) on a LAMP installation on Ubuntu 11 (via tasksel).
i can access
/var/www via ht*p://localhost, but accessing /home/tg/Aptana... via ht*p://ea-dev returns an
"You don't have permission to access / on this server."
this is my apache2.conf: http://pastebin.com/Yja02tnE
this is my ea-dev located in /etc/apache2/sites-available/: http://pastebin.com/U1Vu2jxD
thats what i get in the error.log:
[crit] [client 127.0.0.1]
(13)Permission denied: /home/tg/.htaccess pcfg_openfile: unable to
check htaccess file, ensure it is readable
I really don't understand why its written /home/tg and not /home/tg/Aptana... but maybe its just an abbreviation.
Have you checked to make sure the user running the apache daemon can read the files in the directories in question? I'd start with the .htaccess file. That is almost always the cause of the permission denied error. You may also need to add the tg user to the www-data group.
However, the other thing that stands out is the use of spaces in your path for DocumentRoot... I haven't actually ever done that, so I would also try normalizing your directory path, removing spaces and capital letters. That could explain why the path in the error log does not match the path you expected to see - apache does not normally abbreviate such things.
Good luck and let us know if you make any progress or have additional questions/info.

Apache error log - file does not exist

I am receiving some mysterious errors in my apache error log.
For example:
File does not exist: /home/httpd/vhosts/studentlife.co.il/httpdocs/help_center/div.hot-jobs
File does not exist: /home/httpd/vhosts/studentlife.co.il/httpdocs/solutions/function.filesize
File does not exist: /home/httpd/vhosts/studentlife.co.il/httpdocs/work_abroad/div.publish
Now I don't understand - how did my divs and functions suddenly turn into files?? Of course they do not exist, they are divs and functions written in the code. So I am not sure why I am getting these file does not exist errors.
Also, how can I debug this, since in no place am I trying to access files with these names?
Any insight will be great.
I would say don't worry about it.
I can make a request for /the/answer/to/life/the/universe/and/everything.42 and it would show up in your error log.
Probably some spider is hunting for vulnerabilities in your site and it's randomly trying URLs. If you see the same pages a lot then start checking to see whether you have any broken links, otherwise forget about it.
You could use FireBug to see the return codes (you are looking for 404) of all HTTP requests made when you open your website. Maybe you have some typo in your HTML.
I had this same issue in this scenario:
wamp installation
system was running perfectly til dec 01/2010.
restarted computer on dec 02/2010.
apache wouldn't start up and was logging [Thu Dec 02 09:15:45 2010] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/announce
then, only then, I reminded myself I had just installed SKYPE on dec 01/2010 and that, on windows, we've got this conflict between the phone program and apache fighting for the port 80, I guess.
closed Skype, restarted services and voi là: my system is back. =)
One of my clients had a similar issue with Apache on Windows.
On any request he was getting:
[error] [client 192.168.1.66] File does not exist: D:/apache
I realized that the DocumentRoot was missing form the httpd.conf.
I agree with Gareth, a spider could be hunting for vulnerabilities in your site and it's randomly trying URLs. However, there may be another reason, probably more likely.
After debugging my own scripts to see what was going on, I noticed the following. The error of the form:
[Mon May 06 21:47:29 2013] [error] [client ip] File does not exist: /path/, referer: http://domain/example.html
is visible in the error log and even though it will sound weird, it does not have to do with the static HTML file or script that generates the page. In fact, the source of this problem may be the HTML of the page referencing a broken link to an image/css/js file, so that when the browser receives the HTML and fetches these resources Apache can't find them and prints the "File Does Not Exist" error.
It is nice of Apache as it warns us about broken links.