Apache2: No Effect Of ErrorLogFormat - apache

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.

Related

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.

Custom error log in apache2

In apache log file I am getting long messages such as:
[Wed Feb 21 19:32:18.916451 2018] [:error] [pid 23919] [client 10.0.2.2:50156] Error Message...
How I can get custom log message like:
Format:[Time] [Message]
[19:32:18] Error Message....
Put
ErrorLogFormat "[%{c}t] %M"
in apache config file (supposedly, /etc/apache2/apache2.conf)
Other formatting options you can find in https://httpd.apache.org/docs/2.4/mod/core.html#errorlogformat

"No such file or directory" when using mod_cache

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

localhost/phpmyadmin 404 error

I have installed phpmyadmin, but doesn't seem to work.
I have apache2, php5, php-cgi, mysql-server, mysql-client installed too.
I've added the next line to the apache2.conf file:
#include phpmyadmin
Include /etc/phpmyadmin/*.conf
But when I restart the server, I have the next error:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 2 of /etc/phpmyadmin/lighttpd.conf:
Invalid command 'alias.url', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
And the error log says:
[Tue Aug 13 12:36:25.690262 2013] [mpm_prefork:notice] [pid 13210] AH00163: Apache/2.4.6 (Ubuntu) PHP/5.5.1-2+debphp.org~precise+2 configured -- resuming normal operations
[Tue Aug 13 12:36:25.690358 2013] [core:notice] [pid 13210] AH00094: Command line: '/usr/sbin/apache2'
[Tue Aug 13 12:39:21.635566 2013] [mpm_prefork:notice] [pid 13210] AH00169: caught SIGTERM, shutting down
What should I do to define alias.url, or what am I doing wrong? Thanks
Solved with #Jamie Taylor comment: try changing *.conf to apache.conf.
Then get 403 response forbidden, and solved it by adding:
Order allow,deny
Allow from all
to
<Directory "/usr/share/phpmyadmin"> </Directory>
in /etc/phpmyadmin/apache.conf
And don't forget to uncomment:
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
in /etc/phpmyadmin/config.inc.conf, if you want to use PHPMyAdmin without password (only localhost, of course).

Mercurial does not startup upon system launch [FreeBSD 9.0 Apache22]

Struggling to find a root of issue with Apache22 and mercurial. Everything seems to work right — made repository, folder with properly configured hgweb.cgi, set permissions etc.
Here comes the main problem. Everything works only if I (re)start Apache manually, using /usr/local/etc/rc.d/apache22 restart otherwise, using service apache22 restart or while whole system is booting, I'm getting up and running Apache with website accessible. But once trying to access web interface it gives me "Internal Server Error" in browser and next messages in http-error.log
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] env:
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] python
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] :
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] No such file or directory
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] Premature end of script headers: hgweb.cgi
My guess is that it could be an issue with environment variables but what a heck is a difference between service run and direct call of script from /usr/local/rc.d/ ? Am I missing something?
Check PATH, it look likes python is not in your path. Maybe add /usr/local/bin to the path of the www user
Solution is really about making user running httpd (www in my case) to have $PATH adjusted. But it might not be obvious for everyone so here is what I did:
created /usr/local/etc/apache22/envvars.d/path.env with content
#!/bin/bash
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
This require Apache to have env_module loaded but this looks like a standard module to be loaded in default configuration.