[Dorset] Apache 2.4.2
Is there any experience of Apache 2.4 in this area? As part of an upgrade and installation on a new PC, I installed Apache 2.4, but cannot get it to display .cgi files produced by my APC UPS that is managed by apcupsd version 3.14.8. On an earlier PC, I had Apache 2.2, which displayed the data from the .cgi files, but 2.4 has a very different httpd.conf file, and no matter what permissions I relax, I still get the message Not Found The requested URL /var/www/cgi-bin/multimon.cgi was not found on this server. I have checked that current data is being generated in the multimon.cgi file. Of course, I could always wimp out and install the previous version, but that's not what it's about, is it? Regards Graeme -- Next meeting: 2012-10-?? 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
On 24/09/2012 17:34, Graeme Gemmill wrote: > Is there any experience of Apache 2.4 in this area? As part of an > upgrade and installation on a new PC, I installed Apache 2.4, but > cannot get it to display .cgi files produced by my APC UPS that is > managed by apcupsd version 3.14.8. > On an earlier PC, I had Apache 2.2, which displayed the data from the > .cgi files, but 2.4 has a very different httpd.conf file, and no > matter what permissions I relax, I still get the message > > > Not Found > > The requested URL /var/www/cgi-bin/multimon.cgi was not found on this > server. That should pretty much work out of the box? There is plenty of advice if it is not working here: http://httpd.apache.org/docs/2.4/howto/cgi.html If the configuration has the standard script alias then that should work *unless* the permissions on the cgi file do not include execute access for www-data ? Si -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
Hi Graeme, Simon said: > > The requested URL /var/www/cgi-bin/multimon.cgi was not found on > > this server. ... > If the configuration has the standard script alias then that should > work *unless* the permissions on the cgi file do not include execute > access for www-data ? It might help if we had the permissions of the CGI file in question and every directory above it, e.g. assuming it was the file `foo' then set f to its full path from root and then run this while loop; "$" is my shell's prompt. $ f=/home/tmp/1348682210.641081587/foo $ $ while [[ $f ]]; do ls -ld "$f"; f=${f%/*}; done; ls -ld / -rw-r--r-- 1 ralph ralph 0 2012-09-26 19:01 /home/tmp/1348682210.641081587/foo drwxr-xr-x 3 ralph ralph 4096 2012-09-26 19:01 /home/tmp/1348682210.641081587 drwxrwxrwt 190 root root 12288 2012-09-26 18:56 /home/tmp drwxr-xr-x 20 root root 4096 2011-09-18 18:20 /home drwxr-xr-x 24 root root 4096 2012-09-03 13:55 / $ Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
On 26 September 2012 19:04, Ralph Corderoy wrote: > while [[ $f ]]; do ls -ld "$f"; f=${f%/*}; done; ls -ld / Ralph, that is very cool. It has just gone into my .bashrc as an alias! I had not come across that bash function ${f%/*} before. victor -- best regards, Victor Churchill, Bournemouth -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
Hi Victor, > > while [[ $f ]]; do ls -ld "$f"; f=${f%/*}; done; ls -ld / > > I had not come across that bash function ${f%/*} before. There are various substitutions shells like bash(1) provide on variable expansion that avoid having to kick off a sed. Here's some variations. $s foo,bar,xyzzy ${s#*,} bar,xyzzy ${s##*,}xyzzy ${s%,*} foo,bar ${s%%,*}foo ${s/bar/prohibit} foo,prohibit,xyzzy ${s/o} fo,bar,xyzzy ${s//o} f,bar,xyzzy ${s//[aeiouy]/V}fVV,bVr,xVzzV `#' and `%' are mnemonic in that `#$%' are on `345' on the keyboard with `#' matching at the start of the variable and `%' matching at the end. `/' is obviously traditional at this point, being the common `start of pattern' character in ed(1)'s `s' substitute command. The easy way to get a refresher is `man bash' and search for `##'. Note, the pattern to search for isn't a regexp, more a glob. Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
Hi Victor, > > > while [[ $f ]]; do ls -ld "$f"; f=${f%/*}; done; ls -ld / An expanded version of the above. It takes multiple arguments and cuts out the repetition in the output. $ cat lup #! /bin/bash set -eEu -o pipefail shopt -s failglob trap 'echo ${0##*/}: line $LINENO: unexpected exit: $? >&2' ERR for f; do readlink -e "$f" done | sed ' \#^/$#{p; d} :l p s#/[^/]*$## tc; :c s/./&/ tl s#^#/# ' | xargs ls -Uld | awk '!a[$0] {print; a[$0] = 1}' $ $ ./lup ~ . /etc/{passwd,group} / /var/spool/* drwxr-xr-x 134 ralph ralph 12288 2012-09-27 12:25 /home/ralph drwxr-xr-x 20 root root 4096 2011-09-18 18:20 /home drwxr-xr-x 24 root root 4096 2012-09-03 13:55 / drwxr-xr-x 2 ralph ralph 4096 2012-09-27 12:25 /home/tmp/1348742884.721268840 drwxrwxrwt 189 root root 12288 2012-09-27 11:48 /home/tmp -rw-r--r-- 1 root root 2193 2012-02-23 12:02 /etc/passwd drwxr-xr-x 158 root root 12288 2012-09-27 09:34 /etc -rw-r--r-- 1 root root 1094 2012-02-23 12:02 /etc/group drwxr-xr-x 2 root root 4096 2011-03-05 02:18 /var/spool/anacron drwxr-xr-x 9 root root 4096 2011-03-05 16:46 /var/spool drwxr-xr-x 14 root root 4096 2010-10-07 17:13 /var drwxr-xr-x 5 root root 4096 2010-10-07 17:03 /var/spool/cron drwx--x--- 3 root lp 4096 2011-10-09 11:38 /var/spool/cups drwxrwsr-x 2 root mail 4096 2012-09-27 12:24 /var/mail drwxr-xr-x 3 root root 4096 2010-10-07 17:02 /var/spool/openoffice drwxr-xr-x 2 root root 4096 2010-09-24 13:52 /var/spool/plymouth drwxr-xr-x 20 root root 4096 2011-05-11 11:21 /var/spool/postfix drwxr-x--- 18 proxy proxy 4096 2012-09-27 09:41 /var/spool/squid $ (`lup' just because I already have `l' that does `exec ls -l "$@"'.) Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
On 27/09/12 13:00, dorset-requ...@mailman.lug.org.uk wrote: Message: 1 Date: Wed, 26 Sep 2012 19:04:15 +0100 From: Ralph Corderoy To: Dorset Linux User Group Subject: Re: [Dorset] Apache 2.4.2 Message-ID: <20120926180415.4be2d2b...@orac.inputplus.co.uk> Content-Type: text/plain; charset=utf-8 Hi Graeme, .. It might help if we had the permissions of the CGI file in question and every directory above it, e.g. assuming it was the file `foo' then set f to its full path from root and then run this while loop; "$" is my shell's prompt. $ f=/home/tmp/1348682210.641081587/foo $ $ while [[ $f ]]; do ls -ld "$f"; f=${f%/*}; done; ls -ld / -rw-r--r-- 1 ralph ralph 0 2012-09-26 19:01 /home/tmp/1348682210.641081587/foo drwxr-xr-x 3 ralph ralph 4096 2012-09-26 19:01 /home/tmp/1348682210.641081587 drwxrwxrwt 190 root root 12288 2012-09-26 18:56 /home/tmp drwxr-xr-x 20 root root 4096 2011-09-18 18:20 /home drwxr-xr-x 24 root root 4096 2012-09-03 13:55 / $ Cheers, Ralph. It must be some sort of permission problem. I executed the following $ cd /var/www/cgi-bin [graeme@handel cgi-bin]$ ./multimon.cgi which produced a whole lot of HTML. I put that into a file with .html suffix and opened it in Firefox and got the expected display. I tried to do the same with upsstats.cgi, and in the generated HTML I found the line Access to host 127.0.0.1 is not authorized. The most recent line in the access log is 127.0.0.1 - - [28/Sep/2012:13:06:58 +0100] "GET /var/www/cgi-bin/multimon.cgi HTTP/1.1" 404 226 There is no entry in the error log since 13:00 hrs yesterday. Changing the permissions on /var/www/cgi-bin had no effect. What bit of software processes a .cgi file? Thanks for your interest, Graeme -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue
Re: [Dorset] Apache 2.4.2
Hi Graeme, > [graeme@handel cgi-bin]$ ./multimon.cgi > which produced a whole lot of HTML. > I put that into a file with .html suffix and opened it in Firefox and > got the expected display. > I tried to do the same with upsstats.cgi, and in the generated HTML I > found the line > Access to host 127.0.0.1 is not authorized. So that's two distinct problems? One is having Apache serve up any CGI output from that directory and the other is specific to upsstats.cgi. > The most recent line in the access log is > 127.0.0.1 - - [28/Sep/2012:13:06:58 +0100] "GET > /var/www/cgi-bin/multimon.cgi HTTP/1.1" 404 226 > There is no entry in the error log since 13:00 hrs yesterday. > Changing the permissions on /var/www/cgi-bin had no effect. > What bit of software processes a .cgi file? mod_cgi in Apache arranges for it to be run when it receives the HTTP request from the web browser. You're probably already reading through these pages anyway, but in case you don't have some of them... http://httpd.apache.org/docs/2.4/howto/cgi.html http://httpd.apache.org/docs/2.4/mod/mod_cgi.html http://httpd.apache.org/docs/2.4/mod/mod_alias.html#scriptalias ScriptLog in mod_cgi may be useful. Perhaps show us the section of the conf file you've settled on for /var/www/cgi-bin? Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2012-10-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread on mailing list: mailto:dorset@mailman.lug.org.uk How to Report Bugs Effectively: http://goo.gl/4Xue