Re: [Dorset] nginx Setup / Configuration
On Monday, 20 February 2017 10:40:18 GMT Ralph Corderoy wrote: > If Audio_Guide is hard to type that's because it's not the more normal > audio-guide. Terry, are you putting QR codes about for mobiles to open > the URL? You could have a Wimborne Minster tower. > https://research.swtch.com/qart Once the system is installed, no-one will need to type Audio_Guide, audio- guide or even just Guide (or guide). The function will be accessed from the top level menu. I like the idea of using a QR code to open the URL, especially if it can be based on a picture of the Minster. My original plan was to have the landing page automatically open when the user connects to the WiFi (rather like the cloud does in the pub). If I can't work out how to do that (I haven't really looked at that bit yet), then a QR code would be a good alternative. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi John, > It is possible to get nginx to match catch insensitively if you need > to. You have to use a case-insensitive regex match. Yes, though in Terry's case he has Unix path names that are case sensitive, and URL paths that are too, given URLs were designed on Unix, so he shouldn't introduce ambiguity to cater for those that can't type. :-) If Audio_Guide is hard to type that's because it's not the more normal audio-guide. Terry, are you putting QR codes about for mobiles to open the URL? You could have a Wimborne Minster tower. https://research.swtch.com/qart > nginx location selection algorithm is a little hard to grok at first The key thing I found, especially compared to Apache, is the linear order of rules in the file is not the order of execution. Instead, they're sorted first by type, and then file order. It can help to order them this way in the file. Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On 20 February 2017 at 09:39, Terry Coleswrote: > On Sunday, 19 February 2017 21:55:52 GMT Ralph Corderoy wrote: > > AKA Apache does some brain-damaged DWIM that just digs a deeper hole > > when the magic isn't apparent. :-) > > http://www.catb.org/jargon/html/D/DWIM.html > > :-) > > This comes under the heading of the road to good intentions > > It is possible to get nginx to match catch insensitively if you need to. You have to use a case-insensitive regex match. nginx location selection algorithm is a little hard to grok at first, but it's OK once you get used to it. There's a good, clear description at https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On Sunday, 19 February 2017 21:55:52 GMT Ralph Corderoy wrote: > AKA Apache does some brain-damaged DWIM that just digs a deeper hole > when the magic isn't apparent. :-) > http://www.catb.org/jargon/html/D/DWIM.html :-) This comes under the heading of the road to good intentions Presumably this was done to compensate for Windows users who don't see a difference between lc and uc chars in a filename. The trouble is it hides errors that will bite the user in the b*m, ie me, when the code is ported to a different server. I really thought that it couldn't be a simple as filenames, because it worked on my domain. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > Presumably, Apache works some magic to ignore the case, whereas nginx > doesn't. AKA Apache does some brain-damaged DWIM that just digs a deeper hole when the magic isn't apparent. :-) http://www.catb.org/jargon/html/D/DWIM.html python -c 'import this' Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On Sunday, 19 February 2017 18:28:30 GMT Ralph Corderoy wrote: > Have you found nginx's log files yet? It will give you a clue whether > the request for the MP3 is reaching it from the browser, and what it did > in turn. I did originally, but it didn't tell me anything useful, so I didn't look again until just now; the entry was Error 404 - File not found. > I find I first get re-directed. > > $ curl -sSI > 'http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.mp3' HTTP/1.1 > 301 Moved Permanently > Content-Type: text/html; charset=iso-8859-1 > Connection: keep-alive > Keep-Alive: timeout=15 > Date: Sun, 19 Feb 2017 18:23:21 GMT > Server: Apache > Location: http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.MP3 > > And then told it's audio/mpeg. > > $ curl -sSI > 'http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.MP3' HTTP/1.1 > 200 OK > Content-Type: audio/mpeg > Content-Length: 768 > Connection: keep-alive > Keep-Alive: timeout=15 > Date: Sun, 19 Feb 2017 18:23:39 GMT > Server: Apache > Last-Modified: Sun, 19 Feb 2017 12:21:56 GMT > ETag: "32de88-548e1315f1ce6" > Accept-Ranges: bytes When I tried curl I suddenly got the clue; the filenames in my html are *.mp3 and the actual filenames are *.MP3. I changed the filenames on the server to match the ones in the code and it works! Presumably, Apache works some magic to ignore the case, whereas nginx doesn't. Thanks for all the clues (which I didn't always get). -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > On the Pi 3, doing the above results in all the files having 'rwx' > permissions for the user and no permissions, eg '---' for the world > and group. Once I had spotted this and corrected them to give 'r-x' > permissions, the server worked. I wouldn't expect HTML files, etc., to have an execute bit set. Directories require it to allow them to be searched by name, e.g. does this directory contain the file `foo'? > The two web pages (Audio Guide and Children's Quiz) both open > correctly, but in the Audio Guide, nothing plays when I click on a > link to an item. It works with the Pi 2, but not the Pi 3. Have you found nginx's log files yet? It will give you a clue whether the request for the MP3 is reaching it from the browser, and what it did in turn. I find I first get re-directed. $ curl -sSI 'http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.mp3' HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=iso-8859-1 Connection: keep-alive Keep-Alive: timeout=15 Date: Sun, 19 Feb 2017 18:23:21 GMT Server: Apache Location: http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.MP3 And then told it's audio/mpeg. $ curl -sSI 'http://www.hadrian-way.co.uk/WMT/Guide/2)%20Gardens%20Area.MP3' HTTP/1.1 200 OK Content-Type: audio/mpeg Content-Length: 768 Connection: keep-alive Keep-Alive: timeout=15 Date: Sun, 19 Feb 2017 18:23:39 GMT Server: Apache Last-Modified: Sun, 19 Feb 2017 12:21:56 GMT ETag: "32de88-548e1315f1ce6" Accept-Ranges: bytes > Are there any codecs or encoders that need to be installed on the > server for the audio tag to work in html5? nginx is just serving up files and stating their MIME type. I don't think it has anything to do with whether audio plays in a browser or not. Or is your test browser also on the Pi at the moment? Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > Stephen Wolff wrote: > > might be mime types but i'd have thought nginx would have mp3s by > > default (if thats the audio file type) > > They are all MP3s. What should I be looking for? A suitable Content-Type header in the HTTP reply. Try this one, then replace the URL with one of the MP3 files. curl -sSI http://dorset.lug.org.uk/wiki/logo.png Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On Sunday, 19 February 2017 17:48:48 GMT Stephen Wolff wrote: > might be mime types but i'd have thought nginx would have mp3s by default > (if thats the audio file type) They are all MP3s. What should I be looking for? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
might be mime types but i'd have thought nginx would have mp3s by default (if thats the audio file type) Sent from a mobile device! > On 19 Feb 2017, at 17:17, Terry Coleswrote: > > On Sunday, 19 February 2017 11:46:33 GMT Ralph Corderoy wrote: >>> So the question is why is it OK on my website and not on the Pi? >> >> In both cases you're surfing, and typing underscore, into your phone? > > Yes. > > I discovered what was going wrong. As pointed out at the beginning of this > discussion it > was a permissions thing, but what has changed to cause the problem now, I > have no idea. > > On the Pi 2 running the August version, I believe that I did what I am now > doing; I copied > the web files and directories from my home directory to /var/www/html using > sudo cp -R * > . To the best of my recollection I didn't have to do anything else. > > On the Pi 3, doing the above results in all the files having 'rwx' > permissions for the user > and no permissions, eg '---' for the world and group. Once I had spotted > this and > corrected them to give 'r-x' permissions, the server worked. > > Well almost. > > The two web pages (Audio Guide and Children's Quiz) both open correctly, but > in the > Audio Guide, nothing plays when I click on a link to an item. It works with > the Pi 2, but not > the Pi 3. > > Are there any codecs or encoders that need to be installed on the server for > the audio tag > to work in html5? I tried installing the nginx-extras package and also > scanned through all > the packages associated with audio, but nothing was obvious. > > PS the latest version is now at > http://www.hadrian-way.co.uk/WMT/index.html[1] > > -- > > > >Terry Coles > > > [1] http://www.hadrian-way.co.uk/WMT/index.html > -- > Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 > Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ > New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING > Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > > But Jon meant the user that nginx runs as when processing incoming > > HTTP requests, e.g. `www-data'. This is done so an error in nginx, > > or in code you ask it to run, has limited access rights when it goes > > haywire, or is exploited by an attacker. > > Hmm. I think I understand. If I can use Firefox to execute any command line I like on your Pi through nginx then better they run as www-data rather than terry or root because www-data is only being used for web serving, not your household accounts, or setting user passwords. > > $ ps o user,uid,pid,ppid,command `pidof nginx` > > USER UID PID PPID COMMAND > > root 0 3381 1 nginx: master process /usr/sbin/nginx -g > > daemon on; master_process on; > > www-data33 3383 3381 nginx: worker process > > www-data33 3384 3381 nginx: worker process > > www-data33 13213 3381 nginx: worker process > > $ > > I wouldn't have known how to identify the user that nginx runs as > other than looking in top. That said 'root'. Yes, nginx is started as root because it needs to listen on TCP port 80 as that's allocated for HTTP requests, and the low numbered ports need root access. But the child processes it forks to do work that don't require root privileges change their UID to www-data. You can see that in the ps(1) output above, and follow the PPID, parent PID, column to the PID one. > > > http://hadrian-way.co.uk/Audio_Guide/audio_guide.html > > > http://hadrian-way.co.uk/Kiddies_Quiz/index.html > > To clarify; I can surf to the Audio Guide or the Kiddies Quiz, by > typing in the links I gave you to my own webserver and it works. On > the Raspberry Pi they didn't, even when the code (meaning directory > names) was identical to that on my domain. When I shortened the > directory names (and changed the Audio Guide html page to index.html), > everything worked. > > So the question is why is it OK on my website and not on the Pi? In both cases you're surfing, and typing underscore, into your phone? Try, as root on the server, e.g. `sudo -i', cd /var/www/html mkdir x y_z echo x here >x/t.txt echo y_z here >y_z/t.txt You should be able to access those from Linux with $ curl -sS http://FIXME/{x,y_z}/t.html x here y_z here $ Then also try your phone. There's also /var/log/nginx to look at if you can re-create the original problem, e.g. moving the directory names' back. Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On Sunday, 19 February 2017 10:52:37 GMT Ralph Corderoy wrote: > > > sudo -i -u nginx > > > > > > (Replace nginx with the actual user name) > > > > The user is root. Is that normal? > > No, the user isn't root. The user and group on /var/www/html is > root:root; that's normal. But Jon meant the user that nginx runs as > when processing incoming HTTP requests, e.g. `www-data'. This is done > so an error in nginx, or in code you ask it to run, has limited access > rights when it goes haywire, or is exploited by an attacker. Hmm. I think I understand. I wouldn't have known how to identify the user that nginx runs as other than looking in top. That said 'root'. > > My recollection is that I only changed those names on the Pi (compared > > to the version on my server), to make typing easier, > > You are aware of Tab completion in the shell? `cd Aud' completes > to Audio_Guide. :-) Of course. It wasn't in the shell that I was having difficulty; it was typing the full path into the browser on the phone. (I'm just working on a landing page, with buttons to link to the underlying functions.) > > but clearly having the Directory names as Audio_Guide and Kiddies_Quiz > > instead of Guide and Quiz was what was needed. Why would that be? > > You earlier wrote: > > The latest pages are working on my website at: > > http://hadrian-way.co.uk/Audio_Guide/audio_guide.html > > > > and > > > > http://hadrian-way.co.uk/Kiddies_Quiz/index.html > > nginx is taking the path part of the URL, from the `/' after the domain > name to the optional query parameters starting with a `?', and trying to > access that tacked on to /var/www/html. If the URL's path is > Audio_Guide then the directory has to match. This is why I suggested a > simple top-level now.txt as a known thing under /var/www/html. Or am I > misunderstanding the question? To clarify; I can surf to the Audio Guide or the Kiddies Quiz, by typing in the links I gave you to my own webserver and it works. On the Raspberry Pi they didn't, even when the code (meaning directory names) was identical to that on my domain. When I shortened the directory names (and changed the Audio Guide html page to index.html), everything worked. So the question is why is it OK on my website and not on the Pi? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > pi@raspberrypi:/var/www/html $ ls -ld > drwxr-xr-x 4 root root 4096 Feb 19 09:19 . > pi@raspberrypi:/var/www/html $ ls -la > total 20 > drwxr-xr-x 4 root root 4096 Feb 19 09:19 . > drwxr-xr-x 3 root root 4096 Aug 10 2016 .. > drwxr-xr-x 2 root root 4096 Aug 18 2016 Guide > -rw-r--r-- 1 root root 867 Feb 19 09:19 index.html > drwxr-xr-x 2 root root 4096 Aug 18 2016 Quiz They're fine. > > sudo -i -u nginx > > > > (Replace nginx with the actual user name) > > The user is root. Is that normal? No, the user isn't root. The user and group on /var/www/html is root:root; that's normal. But Jon meant the user that nginx runs as when processing incoming HTTP requests, e.g. `www-data'. This is done so an error in nginx, or in code you ask it to run, has limited access rights when it goes haywire, or is exploited by an attacker. $ ps o user,uid,pid,ppid,command `pidof nginx` USER UID PID PPID COMMAND root 0 3381 1 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; www-data33 3383 3381 nginx: worker process www-data33 3384 3381 nginx: worker process www-data33 13213 3381 nginx: worker process $ > > Then make sure you can read one of the files. The aim was to see if the pleb www-data can read the files that you want to serve. > My recollection is that I only changed those names on the Pi (compared > to the version on my server), to make typing easier, You are aware of Tab completion in the shell? `cd Aud' completes to Audio_Guide. > but clearly having the Directory names as Audio_Guide and Kiddies_Quiz > instead of Guide and Quiz was what was needed. Why would that be? You earlier wrote: > The latest pages are working on my website at: > http://hadrian-way.co.uk/Audio_Guide/audio_guide.html > and > http://hadrian-way.co.uk/Kiddies_Quiz/index.html nginx is taking the path part of the URL, from the `/' after the domain name to the optional query parameters starting with a `?', and trying to access that tacked on to /var/www/html. If the URL's path is Audio_Guide then the directory has to match. This is why I suggested a simple top-level now.txt as a known thing under /var/www/html. Or am I misunderstanding the question? Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
OK, I've fixed it, but I'm not sure why. More about that later. Replying to both Ralph and John: === Ralph === On Saturday, 18 February 2017 17:47:32 GMT Ralph Corderoy wrote: > What's the user, group, and permissions on /var/www, e.g. `ls -ld > /var/www'? pi@raspberrypi:/var/www/html $ ls -ld drwxr-xr-x 4 root root 4096 Feb 19 09:19 . pi@raspberrypi:/var/www/html $ ls -la total 20 drwxr-xr-x 4 root root 4096 Feb 19 09:19 . drwxr-xr-x 3 root root 4096 Aug 10 2016 .. drwxr-xr-x 2 root root 4096 Aug 18 2016 Guide -rw-r--r-- 1 root root 867 Feb 19 09:19 index.html drwxr-xr-x 2 root root 4096 Aug 18 2016 Quiz These permissions are identical for the Pi 2 running the SD Card that worked in August and the Pi 3 running the latest Raspbian. (Except, this gave me the clue, because the directory names were different on the two devices). === John == On Saturday, 18 February 2017 18:00:25 GMT John Carlyle-Clarke wrote: > Hi Terry. It's probably file permissions. Check what user the nginx server > runs as, and make sure they have access to the files. They will need rx > permission at least to every directory down to them from / as well, I > believe. > > To check, switch to root then do: Why do I need to switch to root ? The command below is prefixed with sudo. > sudo -i -u nginx > > (Replace nginx with the actual user name) The user is root. Is that normal? > Then make sure you can read one of the files. Well the command put me into the root home directory, so I wasn't sure what this was doing. === The solution === When I spotted that the the directory names were different on the two devices, I tried surfing to the correct one on the Pi 2; this worked (I had forgotten that I changed them when I moved to the Pi. I then changed the directory names on the Pi 3 to match the Pi 2 and everything worked. My recollection is that I only changed those names on the Pi (compared to the version on my server), to make typing easier, but clearly having the Directory names as Audio_Guide and Kiddies_Quiz instead of Guide and Quiz was what was needed. Why would that be? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > > What's the user, group, and permissions on /var/www, e.g. `ls -ld > > /var/www'? > > The content is in /var/www/html. Is it the permissions of that > directory or the higher one? That one, sorry. I took the `html directory at /var/www' as a description of /var/www. :-) Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry. It's probably file permissions. Check what user the nginx server runs as, and make sure they have access to the files. They will need rx permission at least to every directory down to them from / as well, I believe. To check, switch to root then do: sudo -i -u nginx (Replace nginx with the actual user name) Then make sure you can read one of the files. If you can't get a shell that way, try: sudo -u nginx bash On 18 Feb 2017 5:14 pm, "Terry Coles"wrote: > Hi, > > Back in August we had some discussion about setting up a webserver to run > in a walled > garden (literally :-) ) at the Wimborne Model Town. As a proof of > concept, I created two > simple pages (Audio Guide and Kiddies Quiz, see below) and put them onto a > Raspberry Pi > running nginx. At the time they worked perfectly when I connected the Pi > to a Wireless AP > mounted on a pole in the corner of the site. (I was able to use both > functions from my > phone.) > > Since then, we've pretty much concentrated on the bells project and I've > only picked this > up again in the last few days. The problem is, that I can't get access to > the two pages > anymore ;-( I can connect to the nginx landing page at the root of the > server, but anything > else gives me an error 403 (do not have permission to view the page). > > Quite a few things have changed since then and I confess that I never > tested the original > SD Card before I copied it and went through a full upgrade + installation > of the code for > the UPS Pico that we are using. > > The problem seems to come down to the fact that I can no longer access the > content that > I've copied into the html directory at /var/www. Worse, I've just plugged > the original SD > Card into my old Pi 2 (not the Pi 3 we are using for the WMT) and I'm > getting the same > problem. > > The only other thing that has changed since then is the router (I'm not > even trying to > access the Pi from an independent AP yet), but since I can get to the > nginx landing page, I > can't see that that is relevant. > > Any ideas what could be going on here? > > The latest pages are working on my website at: > > http://hadrian-way.co.uk/Audio_Guide/audio_guide.html > > and > > http://hadrian-way.co.uk/Kiddies_Quiz/index.html[1] > > -- > > > > Terry Coles > > > [1] http://hadrian-way.co.uk/Kiddies_Quiz/index.html > -- > Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 > Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ > New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING > Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
On Saturday, 18 February 2017 17:47:32 GMT Ralph Corderoy wrote: Ralph, I've got a few things to do tonight, so won't get onto this until tomorrow. In the meantime: > Does your nginx set-up have /etc/nginx/sites-{available,enabled}? Are > symlinks in the latter pointing at configuration files in the former? > Might just be `default' unless you've added others. Just the default is enabled. I think that is needed to get the nginx landing page to work anyway. > What's the user, group, and permissions on /var/www, e.g. `ls -ld > /var/www'? The content is in /var/www/html. Is it the permissions of that directory or the higher one? > Create a simple file in there. > > sudo sh -c 'date >/var/www/now.txt' > sudo chmod 444 /var/www/now.txt Again. Should this be in /var/www/html? > And then attempt to fetch that with curl(1) so the complicted browser > isn't involved. What `hostname' are you using in the URL? > > curl -sS http://127.1/now.txt # On the Pi. > curl -sS http://FIXME/now.txt # Elsewhere. I'll report back tomorrow. Thanks. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] nginx Setup / Configuration
Hi Terry, > The problem is, that I can't get access to the two pages anymore ;-( I > can connect to the nginx landing page at the root of the server, but > anything else gives me an error 403 (do not have permission to view > the page). ... > The problem seems to come down to the fact that I can no longer access > the content that I've copied into the html directory at /var/www. If you stop nginx, e.g. `sudo systemctl stop nginx', does the browser now fail to connect? You might have to Shift-Reload to persuade it to try again. That will suggest you are talking to the correct server. Is nginx writing to log files, e.g. /var/log/nginx/*.log? Anything useful at the end of those? You can watch them with `tail -F *.log' during your attempts. Hit Enter a few times to get some blank lines so you can see what's new. Does your nginx set-up have /etc/nginx/sites-{available,enabled}? Are symlinks in the latter pointing at configuration files in the former? Might just be `default' unless you've added others. What's the user, group, and permissions on /var/www, e.g. `ls -ld /var/www'? Create a simple file in there. sudo sh -c 'date >/var/www/now.txt' sudo chmod 444 /var/www/now.txt And then attempt to fetch that with curl(1) so the complicted browser isn't involved. What `hostname' are you using in the URL? curl -sS http://127.1/now.txt # On the Pi. curl -sS http://FIXME/now.txt # Elsewhere. Cheers, Ralph. -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] nginx Setup / Configuration
Hi, Back in August we had some discussion about setting up a webserver to run in a walled garden (literally :-) ) at the Wimborne Model Town. As a proof of concept, I created two simple pages (Audio Guide and Kiddies Quiz, see below) and put them onto a Raspberry Pi running nginx. At the time they worked perfectly when I connected the Pi to a Wireless AP mounted on a pole in the corner of the site. (I was able to use both functions from my phone.) Since then, we've pretty much concentrated on the bells project and I've only picked this up again in the last few days. The problem is, that I can't get access to the two pages anymore ;-( I can connect to the nginx landing page at the root of the server, but anything else gives me an error 403 (do not have permission to view the page). Quite a few things have changed since then and I confess that I never tested the original SD Card before I copied it and went through a full upgrade + installation of the code for the UPS Pico that we are using. The problem seems to come down to the fact that I can no longer access the content that I've copied into the html directory at /var/www. Worse, I've just plugged the original SD Card into my old Pi 2 (not the Pi 3 we are using for the WMT) and I'm getting the same problem. The only other thing that has changed since then is the router (I'm not even trying to access the Pi from an independent AP yet), but since I can get to the nginx landing page, I can't see that that is relevant. Any ideas what could be going on here? The latest pages are working on my website at: http://hadrian-way.co.uk/Audio_Guide/audio_guide.html and http://hadrian-way.co.uk/Kiddies_Quiz/index.html[1] -- Terry Coles [1] http://hadrian-way.co.uk/Kiddies_Quiz/index.html -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR