"No such file or directory" when using mod_cache - apache

I am trying to configure mod_cache to cache all web pages. I get this header every time I hit refresh
X-Cache-Detail:""cache miss: attempting entity save" from 1webwb1"
I turn on debug logging and I get this for every resource that I am trying to cache:
[Tue Jun 23 11:16:49.223441 2015] [cache:debug] [pid 31903] mod_cache.c(1326): [client 172.31.217.72:65082] AH00769: cache: Caching url: /resource?param=x, referer: http://mywebsite/
[Tue Jun 23 11:16:49.223453 2015] [cache:debug] [pid 31903] mod_cache.c(1332): [client 172.31.217.72:65082] AH00770: cache: Removing CACHE_REMOVE_URL filter., referer: http://mywebsite/
[Tue Jun 23 11:16:49.223497 2015] [cache:debug] [pid 31903] mod_cache.c(700): (2)No such file or directory: [client 172.31.217.72:65082] AH00765: cache: Cache provider's store_body failed!, referer: http://mywebsite/
I could post my httpd.conf, but honestly I used (almost) the exact same configuration on a different box and it worked.
Is there something on the box or httpd installation that could be causing this error? I am using httpd-2.4.6-18.0.1.el7_0.x86_64 on both boxes.

We've encountered the same issue. We have fixed it by changing the cache directory from /var/tmp/apache to /var/cache/apache and properly setting the permissions:
our_apache.conf:
CacheRoot /var/cache/apache
As root user:
# mkdir /var/cache/apache
# chown apache:apache /var/cache/apache
# chmod 0700 /var/cache/apache
For some reason, the permissions on /var/tmp seem to be a problem:
# ls -ld /var/tmp
drwxrwxrwt. 8 root root 4096 Mar 14 10:30 /var/tmp

Related

Apache2: No Effect Of ErrorLogFormat

i changed ErrorLogFormat at /etc/apache2/apache2.conf, but the this doesn't effect the log. I also added my ErrorLogFormat to the config files in the sites-enabled directory, but no effect.
ErrorLogFormat "[%{%Y-%m-%d %H:%M:%S}t] [%l] [client %a] %M"
This is the log:
[Sat Oct 13 13:01:56 2018] [error] [client 123.123.123.123:41204] AH01790: user `asd' in realm `some realm' not found: /
EDIT: It's running on a rasperry pi updated. I tested: stop and start, restart on the apache service and system reboot.
grep -r "ErrorLogFormat" /etc/apache2
revealed only the desired format, that i added at apache.conf and the conf files at sites-enabled.
In Apache 2.4 (https://httpd.apache.org/docs/2.4/mod/core.html#errorlogformat), you can use:
ErrorLogFormat "[%{cu}t] [%l] [client %a] %M"
%{cu}t: The current time in compact ISO 8601 format, including micro-seconds
In the log file it will show:
[2018-10-14 10:31:05.273482] [debug] [client AH00931: initialized single connection worker in child 4296 for (localhost)
The date format is the same as what you want, without having to specify all the rules you have.
If you use %{u}t, the log format becomes:
[Sun Oct 14 10:30:31.944078 2018] [info] [client ::1:47376] AH00128: File does not exist: /home/mbert/tools/apache/htdocs/so/oij
which is what you had previously.

Apache/XAMPP does not give access to subdirectory

I set my document root to a git repository of three.js, and the root directory lists all subfolders, except examples/. It also doesn't list files and folders starting with . (understandable, I guess) and README.md. Trying to access examples directly gives a 503 error.
There are no .htaccess files anywhere. There is no IndexIgnore anywhere. Error.log lists this:
[Sat Jun 02 13:35:08.169886 2018] [proxy:error] [pid 20844:tid 1996] (OS 10061)No connection could be made because the target machine actively refused it. : AH00957: AJP: attempt to connect to 127.0.0.1:8009 (127.0.0.1) failed
[Sat Jun 02 13:35:08.169886 2018] [proxy:error] [pid 20844:tid 1996] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 5s
[Sat Jun 02 13:35:08.169886 2018] [proxy_ajp:error] [pid 20844:tid 1996] [client 127.0.0.1:57788] AH00896: failed to make connection to backend: 127.0.0.1
In your apache conf folder, see if you have a file named /extra/httpd-ajp.conf with a line like this:
ProxyPass /examples ajp://127.0.0.1:8009/examples smax=0 ttl=60 retry=5
If so, comment out or delete that line. Fixed the problem for me.

password protect website with .htaccess and .htpasswd - error - "Could not open password file:"

We have Plesk site builder through our webhosting with Charter. Using it to create a simple development website.
I am trying to password protect the site using .htaccess / .htpasswd.
I keep getting this error no matter what I do:
[Wed Apr 06 09:02:57 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /.htpasswd
[Wed Apr 06 09:02:57 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
[Wed Apr 06 09:03:52 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/.htpasswd
[Wed Apr 06 09:03:52 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'admin' not configured
[Wed Apr 06 09:03:56 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/.htpasswd
[Wed Apr 06 09:03:56 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
[Wed Apr 06 09:05:11 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/HTTP/.htpasswd
[Wed Apr 06 09:05:11 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'admin' not configured
[Wed Apr 06 09:05:15 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/HTTP/.htpasswd
[Wed Apr 06 09:05:15 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
I'm not very familiar with Parallels Plesk - and getting a hold of their support is like pulling teeth.
I've checked and double checked the path to the .htpasswd file; seems right.
I've moved it and the .htaccess file to see if I just
don't have it in the right place
I'm not sure what the problem is. I get the authentication box (I notice it doesn't have my "Please Login" message though...
here is the code for the .htaccess file:
#
# AUTHENTICATION
#
### BASIC PASSWORD PROTECTION
AuthUserFile /etc/httpd/HTTP/.htpasswd
AuthName "Please Login"
AuthType basic
<Limit GET POST>
Require valid-user
</Limit>
ANY Help is greatly appreciated or leads in the right direction. THANKS IN ADVANCE!!
Just generate /etc/httpd/HTTP/.htpasswd file by command:
# htpasswd /etc/httpd/HTTP/.htpasswd UserNameYouWant
it asks you for password and generate password file with user UserNameYouWant
Are you sure the file .htpasswd is there in /etc/httpd/HTTP/ directory. otherwise create 1 with the below command
sudo htpasswd -c /etc/apache2/.htpasswd heather
Here you go for step by step configuration:
If you're using CentOS, then probably SELinux is blocking access to that file if the file is outside the webserver root directory. (that's what happened to me).
Solution
Move the file to your web server root directory then restore the file SELinux context using these commands :
mv /path/to/.httpasswd /var/www/html/
restorecon -v /var/www/html/.htpasswd
It's probably a permissions issue if you think the file is in the right place.
Check the file ownership and permissions with:
ls -la /path/to/file
Make sure the file/group that your apache process runs as is able to read the file.
You can check the owner of the process by running:
ps -ef | grep apache
You should see the owner of the process in the leftmost column.
If file ownership is the issue, then use chown to change ownership:
sudo chown username: /path/to/file
You need to do this as root/sudo as non-root users don't have the right to change the ownership normally.
The : after the username changes the group over to the same as the username
I ran into the same problem. For me, .htpasswd was stored under the /home/username/.htpasswds directory. I solved the error by recursively making sure the directory is executable:
chmod +x -R /home/username/.htpasswds
I had the same problem on a Rackspeed server. It was because the file passwd was missing in /home/company/.htpasswds/project/

503 Error On Fedora 22 Server Using Apache 2.4 and Mono

I am currently attempting to setup a home webserver. I have a lot of experience programming in C# and have been using Visual Studio and IIS for years. I recently decided to make the move to Linux and have been rebuilding my code bases using MonoDevelop. I have them compiling on my development machine, so I am setting up a home server with Fedora 22 Server, and Apache 2.4.
Using nothing but the default configuration the server is able to serve html pages without a problem, but when I installed Mono, and its dependencies, I have been getting various errors, and they are not detailed enough for someone with my limited experience to resolve. I have spent the entire week working on the issue, and here is where I am stuck.
When browsing to http://71.41.214.194/LDC-Demo/index.aspx, I get a "503 Service Unavailable" error in the browser. When looking at the Apache Error log I get the following:
[Fri Oct 09 15:22:41.809588 2015] [:error] [pid 7577] Failed to connect to mod-mono-server after several attempts to spawn the process.
Since that is not enough to discern the issue, I restarted Apache and tried to reload the page (I was hoping for a related error that could help me chase down the problem)
[Fri Oct 09 15:38:22.000257 2015] [mpm_prefork:notice] [pid 7564] AH00170: caught SIGWINCH, shutting down gracefully
[Fri Oct 09 15:38:23.011225 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011668 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011770 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:24.068911 2015] [core:notice] [pid 7641] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Oct 09 15:38:24.069933 2015] [suexec:notice] [pid 7641] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globa$
[Fri Oct 09 15:38:24.079961 2015] [auth_digest:notice] [pid 7641] AH01757: generating secret for digest authentication ...
[Fri Oct 09 15:38:24.080817 2015] [lbmethod_heartbeat:notice] [pid 7641] AH02282: No slotmem from mod_heartmonitor
[Fri Oct 09 15:38:24.088966 2015] [mpm_prefork:notice] [pid 7641] AH00163: Apache/2.4.16 (Fedora) mod_mono/3.12 configured -- resuming normal operations
[Fri Oct 09 15:38:24.088993 2015] [core:notice] [pid 7641] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Oct 09 15:38:36.414478 2015] [:error] [pid 7651] Failed to connect to mod-mono-server after several attempts to spawn the process.
After researching each of these messages to the best of my ability, I could not find anything that was related to the issue. I did find that I could see some more details if I ran the command "journalctl -xe -cat".
Started The Apache HTTP Server.
mono[7646]: segfault at 5 ip 0000000000512710 sp 00007fffa85f01b0 error 6 in mono-sgen[400000+34d000]
<audit-1130> pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Unregistered Authentication Agent for unix-process:7633:25881589 (system bus name :1.83, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7649 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7649]: segfault at 5 ip 0000000000512710 sp 00007ffe5ca30440 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
Not saving repeating crash in '/usr/bin/mono-sgen'
<audit-1400> avc: denied { sigchld } for pid=7647 comm="abrt-hook-ccpp" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=0
Failed to create core_backtrace: waitpid failed: Permission denied
Blacklisted package 'mono-core'
'post-create' on '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644' exited with 1
Deleting problem directory '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644'
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7661 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7661]: segfault at 5 ip 0000000000512710 sp 00007ffed5a32ee0 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
There is a lot more information in these messages, but I am still having a problem finding the cause. The last 5 lines are repeated three times.
I have tried making modifications to the apache config file (httpd.conf) as well as to the mod_mono.conf file, but nothing seems to get me past the problem.
In my current configuration the mod_mono.conf file is unmodified from the default configuration, and the only change that I have made to httpd.conf is to add a virtual host section as follows:
<VirtualHost *:80>
ServerName LDC-Demo
ServerAdmin root#localhost
ServerAlias LDC-Demo
DocumentRoot /var/www/html/LDC-Demo/
MonoServerPath LDC-Demo "/usr/bin/mod-mono-server4"
MonoDebug LDC-Demo true
MonoSetEnv LDC-Demo MONO_IOMAP=all
MonoApplications LDC-Demo "/:/var/www/html/LDC-Demo"
<Location "/LDC-Demo">
Allow from all
Order allow,deny
MonoSetServerAlias LDC-Demo
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
</VirtualHost>
Any ideas would be appreciated, as I stated above, I have been working on this all week, and am not making much progress.
I entered this above as a comment, but I intended to answer the question.
I figuered it out. Fedora runs SELinux, and it was interfering with the permissions needed for mod_mono to run. To see these settings I ran the command: getenforce Then to temporarily change the setting I used the following command: setenforce 0 Finally, restart Apache: apachectl restart I refreshed the web browser and the page loaded correctly. To make the setting permanant, edit the selinux file: nano /etc/sysconfig/selinux I rebooted the server, and tried to load the webpage again. Eureka! everything is working.

Premature End of Script Headers from git-http-backend

I am attempting to install git and Apache on Windows. I have installed MSYSGit 1.7.3 on my Windows 2008 server (x64). I selected that the git commands should work from a Windows command prompt when I installed msysgit.
I have added these lines to my http.conf file:
SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ "C:/Progra~2/git/libexec/git-core/git-http-backend.exe/"
<Directory />
Options +ExecCGI
Allow from all
</Directory>
I created a repository (MKE_Playground.git). I added a file test.txt.
When I attempt to access the URL http://localhost/git/MKE_Playground.git I get this error in the Apache log:
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Child process is running
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Acquired the start mutex.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting 64 worker threads.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting thread to listen on port 80.
127.0.0.1 - - [01/Feb/2011:15:56:14 -0600] "GET /git/MKE_Playground.git HTTP/1.1" 500 539
[Tue Feb 01 15:56:14 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
I know that this means that the headers from the script were malformed. If I were writing the script I would check there, but I assume that the git backend typically provides correct headers. My take on this is that the git http backend failed for some reason. Where can I go to determine why it failed? Is there a Git log someplace?
Pat O
I dealt with a similar problem earlier.
Running "git-http-backend.exe" in a Cygwin shell revealed that the dll, "libiconv2.dll" could not be found. The file is located in the git/bin directory for my Git install (mostly defaults). I added the bin and libexec directories of the git install to my Path, and was able to clone the git repository locally through Apache.
Note: My Apache error logs looked like this - git-http-backend.exe was failing on the missing dll, but not reporting that in the httpd logs:
[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting 64 worker threads.
[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting thread to listen on port 80.
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
This worked for my 1.7.6.msysgit.0 setup:
In http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/, Jeremy Skinner suggests that it must be possible to run Git\libexec\git-http-backend.exe in a Windows cmd shell. When this fails, copy Git\bin\libiconv-2.dll and Git\bin\libiconv2.dll to Git\libexec\git-core and try again. If you can call git-http-backend.exe and it gives you a "500 Internal Server Error", try your clone or fetch again.
I was fighting the same issue. In my case it was a user permission problem. You can check the "log on" information for the Apache Windows Service and test with your domain user for instance (Control Panel->Administrative Tools->Services->Apache->Log On Tab).
After a reboot, browsing to your http://localhost/git/MKE_Playground.git should then give you a Request not supported error in your error.log. That's fine.
git clone http://localhost/git/MKE_Playground.git should work then.
I have abandonded the idea of running Git on Windows. As such this is no longer an issue for me.
Thanks for your help.