9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] rc-httpd
@ 2021-02-01 21:49 thinktankworkspaces
  2021-02-01 22:24 ` ori
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: thinktankworkspaces @ 2021-02-01 21:49 UTC (permalink / raw)
  To: 9front

Just having bit of an issue getting this up for the first time. 

I thought it was as simple as creating a file in:

/rc/bin/rc-httpd/handlers/select-handler

#!/bin/rc

PATH_INFO=$home/www/
SERVER_NAME=yoda

switch($SERVER_NAME) {
case 172.27.0.67
	FS_ROOT=$home/www/yoda
	exec static-or-index
case*
	error 503
}

Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www

No errors in /sys/log/www
But I discovered on the server the following error:
/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 

It didn't really matter if I ran the command as glenda in drawterm or on the console. The
error was the same if I curl 172.27.0.67

I know I'm missing something simple
also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?

I don't really have DNS setup so I was just testing with the IP address first.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 21:49 [9front] rc-httpd thinktankworkspaces
@ 2021-02-01 22:24 ` ori
  2021-02-01 22:45 ` Stanley Lieber
  2021-02-01 23:05 ` james palmer
  2 siblings, 0 replies; 9+ messages in thread
From: ori @ 2021-02-01 22:24 UTC (permalink / raw)
  To: 9front

Quoth thinktankworkspaces@gmail.com:
> Just having bit of an issue getting this up for the first time. 
> 
> I thought it was as simple as creating a file in:
> 
> /rc/bin/rc-httpd/handlers/select-handler
> 
> #!/bin/rc
> 
> PATH_INFO=$home/www/
> SERVER_NAME=yoda
> 
> switch($SERVER_NAME) {
> case 172.27.0.67
> 	FS_ROOT=$home/www/yoda
> 	exec static-or-index
> case*
> 	error 503
> }
> 
> Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
> 
> No errors in /sys/log/www
> But I discovered on the server the following error:
> /sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 
> 
> It didn't really matter if I ran the command as glenda in drawterm or on the console. The
> error was the same if I curl 172.27.0.67
> 
> I know I'm missing something simple
> also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?
> 
> I don't really have DNS setup so I was just testing with the IP address first.
> 

rc-httpd handles a single request at a time. it's launched once per
request by listen(8), which runs it via /rc/bin/service/tcp80.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 21:49 [9front] rc-httpd thinktankworkspaces
  2021-02-01 22:24 ` ori
@ 2021-02-01 22:45 ` Stanley Lieber
  2021-02-02  2:16   ` thinktankworkspaces
                     ` (2 more replies)
  2021-02-01 23:05 ` james palmer
  2 siblings, 3 replies; 9+ messages in thread
From: Stanley Lieber @ 2021-02-01 22:45 UTC (permalink / raw)
  To: 9front

On February 1, 2021 4:49:44 PM EST, thinktankworkspaces@gmail.com wrote:
>Just having bit of an issue getting this up for the first time. 
>
>I thought it was as simple as creating a file in:
>
>/rc/bin/rc-httpd/handlers/select-handler
>
>#!/bin/rc
>
>PATH_INFO=$home/www/
>SERVER_NAME=yoda
>
>switch($SERVER_NAME) {
>case 172.27.0.67
>	FS_ROOT=$home/www/yoda
>	exec static-or-index
>case*
>	error 503
>}
>
>Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
>
>No errors in /sys/log/www
>But I discovered on the server the following error:
>/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 
>
>It didn't really matter if I ran the command as glenda in drawterm or on the console. The
>error was the same if I curl 172.27.0.67
>
>I know I'm missing something simple
>also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?
>
>I don't really have DNS setup so I was just testing with the IP address first.
>
>

ls -l /sys/log/www

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 21:49 [9front] rc-httpd thinktankworkspaces
  2021-02-01 22:24 ` ori
  2021-02-01 22:45 ` Stanley Lieber
@ 2021-02-01 23:05 ` james palmer
  2 siblings, 0 replies; 9+ messages in thread
From: james palmer @ 2021-02-01 23:05 UTC (permalink / raw)
  To: 9front mailing list

Quoth thinktankworkspaces@gmail.com:
> 
> #!/bin/rc
> 
> PATH_INFO=$home/www/
> SERVER_NAME=yoda
> 
> switch($SERVER_NAME) {
> case 172.27.0.67
> 	FS_ROOT=$home/www/yoda
> 	exec static-or-index
> case*
> 	error 503
> }

this will always 503, you are setting SERVER_NAME to yoda
you also don't want to set PATH_INFO, it is the path portion of the url

> I know I'm missing something simple
> also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?

rc-httpd gets run by /rc/bin/service/tcp80, which gets run by aux/listen when an incoming connection to port 80 occurs.
you do not want it in your cpurc.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 22:45 ` Stanley Lieber
@ 2021-02-02  2:16   ` thinktankworkspaces
  2021-02-02  2:20   ` thinktankworkspaces
  2021-02-02  3:41   ` thinktankworkspaces
  2 siblings, 0 replies; 9+ messages in thread
From: thinktankworkspaces @ 2021-02-02  2:16 UTC (permalink / raw)
  To: 9front




[-- Attachment #2: Type: message/rfc822, Size: 4210 bytes --]

From: Stanley Lieber <sl@stanleylieber.com>
To: 9front@9front.org
Subject: Re: [9front] rc-httpd
Date: Mon, 01 Feb 2021 17:45:54 -0500
Message-ID: <7A820243-652E-42D3-87BD-A81B9E51CE03@stanleylieber.com>

On February 1, 2021 4:49:44 PM EST, thinktankworkspaces@gmail.com wrote:
>Just having bit of an issue getting this up for the first time. 
>
>I thought it was as simple as creating a file in:
>
>/rc/bin/rc-httpd/handlers/select-handler
>
>#!/bin/rc
>
>PATH_INFO=$home/www/
>SERVER_NAME=yoda
>
>switch($SERVER_NAME) {
>case 172.27.0.67
>	FS_ROOT=$home/www/yoda
>	exec static-or-index
>case*
>	error 503
>}
>
>Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
>
>No errors in /sys/log/www
>But I discovered on the server the following error:
>/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 
>
>It didn't really matter if I ran the command as glenda in drawterm or on the console. The
>error was the same if I curl 172.27.0.67
>
>I know I'm missing something simple
>also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?
>
>I don't really have DNS setup so I was just testing with the IP address first.
>
>

ls -l /sys/log/www

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 22:45 ` Stanley Lieber
  2021-02-02  2:16   ` thinktankworkspaces
@ 2021-02-02  2:20   ` thinktankworkspaces
  2021-02-02  3:37     ` sl
  2021-02-02  3:41   ` thinktankworkspaces
  2 siblings, 1 reply; 9+ messages in thread
From: thinktankworkspaces @ 2021-02-02  2:20 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

Okay I simplified select-handler below

#!/bin/rc

switch($SERVER_NAME) {
case 172.27.0.67
	FS_ROOT=/usr/glenda/www/yoda
	exec static-or-index
case*
	error 503
}

I still get the error:

/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied.

and nothing in /sys/log/www which is understandable if it cant write to it for whatever reason


cpu% ls -l w*
ls: w*: 'w*' directory entry not found

cpu% ls -l /rc/bin/service/tc*
--rwxrwxr-x M 64 sys sys 243 Oct  4  2019 /rc/bin/service/tcp17019
--rwxrwxr-x M 64 sys sys  59 Oct  4  2019 /rc/bin/service/tcp17020
--rwxrwxr-x M 64 sys sys  59 Oct  4  2019 /rc/bin/service/tcp80

[-- Attachment #2: Type: message/rfc822, Size: 4210 bytes --]

From: Stanley Lieber <sl@stanleylieber.com>
To: 9front@9front.org
Subject: Re: [9front] rc-httpd
Date: Mon, 01 Feb 2021 17:45:54 -0500
Message-ID: <7A820243-652E-42D3-87BD-A81B9E51CE03@stanleylieber.com>

On February 1, 2021 4:49:44 PM EST, thinktankworkspaces@gmail.com wrote:
>Just having bit of an issue getting this up for the first time. 
>
>I thought it was as simple as creating a file in:
>
>/rc/bin/rc-httpd/handlers/select-handler
>
>#!/bin/rc
>
>PATH_INFO=$home/www/
>SERVER_NAME=yoda
>
>switch($SERVER_NAME) {
>case 172.27.0.67
>	FS_ROOT=$home/www/yoda
>	exec static-or-index
>case*
>	error 503
>}
>
>Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
>
>No errors in /sys/log/www
>But I discovered on the server the following error:
>/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 
>
>It didn't really matter if I ran the command as glenda in drawterm or on the console. The
>error was the same if I curl 172.27.0.67
>
>I know I'm missing something simple
>also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?
>
>I don't really have DNS setup so I was just testing with the IP address first.
>
>

ls -l /sys/log/www

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-02  2:20   ` thinktankworkspaces
@ 2021-02-02  3:37     ` sl
  0 siblings, 0 replies; 9+ messages in thread
From: sl @ 2021-02-02  3:37 UTC (permalink / raw)
  To: 9front

you need to make sure the file /sys/log/www exists, and is
writable by whomever is executing tcp80.

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-01 22:45 ` Stanley Lieber
  2021-02-02  2:16   ` thinktankworkspaces
  2021-02-02  2:20   ` thinktankworkspaces
@ 2021-02-02  3:41   ` thinktankworkspaces
  2021-02-02  3:59     ` sl
  2 siblings, 1 reply; 9+ messages in thread
From: thinktankworkspaces @ 2021-02-02  3:41 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

Okay I got it working. Strange that I had to touch the www file and change its permissions.
But I guess thats a thing

touch /rc/bin/rc-httpd/select-handler
#!/bin/rc

PATH_INFO=$location

switch($SERVER_NAME) {
case 172.27.0.67
	FS_ROOT=/usr/glenda/www/yoda
	exec static-or-index
case*
	error 503
}

touch /usr/glenda/www/yoda/index.html
touch /sys/doc/www
chgrp sys /sys/doc/www
chmod +aw www
mv /rc/bin/service/!tcp80 /rc/bin/service/tcp80

[-- Attachment #2: Type: message/rfc822, Size: 4210 bytes --]

From: Stanley Lieber <sl@stanleylieber.com>
To: 9front@9front.org
Subject: Re: [9front] rc-httpd
Date: Mon, 01 Feb 2021 17:45:54 -0500
Message-ID: <7A820243-652E-42D3-87BD-A81B9E51CE03@stanleylieber.com>

On February 1, 2021 4:49:44 PM EST, thinktankworkspaces@gmail.com wrote:
>Just having bit of an issue getting this up for the first time. 
>
>I thought it was as simple as creating a file in:
>
>/rc/bin/rc-httpd/handlers/select-handler
>
>#!/bin/rc
>
>PATH_INFO=$home/www/
>SERVER_NAME=yoda
>
>switch($SERVER_NAME) {
>case 172.27.0.67
>	FS_ROOT=$home/www/yoda
>	exec static-or-index
>case*
>	error 503
>}
>
>Then running the following commmand: /rc/bin/rc-httpd/rc-httpd >>[2]/sys/log/www
>
>No errors in /sys/log/www
>But I discovered on the server the following error:
>/sys/log/www: rc (tcp80): can't open: '/sys/log/www' access permission denied. 
>
>It didn't really matter if I ran the command as glenda in drawterm or on the console. The
>error was the same if I curl 172.27.0.67
>
>I know I'm missing something simple
>also where Do I run the rc-httpd command. At the end of /rc/bin/cpurc?
>
>I don't really have DNS setup so I was just testing with the IP address first.
>
>

ls -l /sys/log/www

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] rc-httpd
  2021-02-02  3:41   ` thinktankworkspaces
@ 2021-02-02  3:59     ` sl
  0 siblings, 0 replies; 9+ messages in thread
From: sl @ 2021-02-02  3:59 UTC (permalink / raw)
  To: 9front

> touch /sys/doc/www

the example in the rc-httpd(8) man page suggests /sys/log/www.

the installer establishes your file system according to the
proto file at /sys/lib/sysconfig/proto, which should have
created /sys/log/www for you already append only and chmod
662.  the default /rc/bin/service/tcp80 also tries to write
to /sys/log/www.

not sure what happened here.

sl

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-02  4:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 21:49 [9front] rc-httpd thinktankworkspaces
2021-02-01 22:24 ` ori
2021-02-01 22:45 ` Stanley Lieber
2021-02-02  2:16   ` thinktankworkspaces
2021-02-02  2:20   ` thinktankworkspaces
2021-02-02  3:37     ` sl
2021-02-02  3:41   ` thinktankworkspaces
2021-02-02  3:59     ` sl
2021-02-01 23:05 ` james palmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).