Forum OpenACS Q&A: sharing openacs on port 80

Collapse
Posted by Boris Kruvshenko on
Hi all !!

I´m looking for information about haw to share openacs on port 80. I can only share it on a port above 1024 (those first are for the system), but I´m sure it can be posible to share it on port 80....

any idea ????

Thx.

Collapse
Posted by Orzenil Silva Junior on
Hi Boris

If you are using aolserver4 under supervise (as recommended in docs) just put flag -b in your daemontools/run:

File /var/lib/aolserver/{yourserver}/etc/daemontools/run {yourserver} => service0 (example)

#!/bin/sh exec /usr/lib/aolserver4/bin/nsd-postgres -it /var/lib/aolserver/service0/etc/config.tcl -u service0 -g web -b 80

Then restart your service

svc -t /service/service0 (I think youre running Gnu/Linux, right? \Orzenil

Collapse
Posted by Brian Fenton on
Boris,
you need to have root privileges to run it on port 80.

Brian

Collapse
Posted by Boris Kruvshenko on
Hi Orzenil, I have done what you tell me in your email, but:

1.- I do not have daemontools installed (I believe that is
    not important to start the application)

2.- First lines of my config.tcl file are:

"
ns_log notice "nsd.tcl: starting to read config file..."

######################################################################
#
# Instance-specific settings
# These default settings will only work in limited circumstances
# Two servers with default settings cannot run on the same host
#
######################################################################

#---------------------------------------------------------------------
# change to 80 and 443 for production use
set httpport                  8000
set httpsport                443

# The hostname and address should be set to actual values.
set hostname                  [ns_info hostname]
set address                  192.168.1.2

# Note: If port is privileged (usually < 1024), OpenACS must be
# started by root, and, in AOLserver 4, the run script have a
# '-b address' flag which matches the address given above

set server                    "service0"
set servername                "New OpenACS Installation - Development"

set serverroot                "/web/${server}"
"

so I do not know if I have to change anything on it.

3.- When I type what you told me
    "#!/bin/sh exec /usr/lib/aolserver4/bin/nsd-postgres -it
    /var/lib/aolserver/service0/etc/config.tcl -u service0
    -g web -b 80"

    I get next message:
    "[24/Jun/2004:16:20:56][3456.16384][-main-] Notice:
    prebind: bound: 80
    [24/Jun/2004:16:20:56][3456.16384][-main-] Notice:
    nsd.tcl: starting to read config file...
    [24/Jun/2004:16:20:56][3456.16384][-main-] Notice:
    nsd.tcl: finished reading config file."

    and my end log file turns to:

    "[24/Jun/2004:16:21:32][3456.16384][-main-] Notice:
      nsmain: AOLserver/4.0 running
    [24/Jun/2004:16:21:32][3456.16384][-main-] Notice:
      nsmain: security info: uid=1002, euid=1002, gid=1002,
      egid=1002
    [24/Jun/2004:16:21:32][3456.32771][-sched-] Notice:
      sched: starting
    [24/Jun/2004:16:21:32][3456.16384][-main-] Notice:
      nssock: listening on 192.168.1.2:8000
    [24/Jun/2004:16:21:32][3456.131081][-driver-] Notice:
      starting
    [24/Jun/2004:16:21:32][3456.131081][-driver-] Notice:
      driver: accepting connections
    [24/Jun/2004:16:21:32][3456.16384][-main-] Warning:
      prebind: closed unused: 0.0.0.0:80 = 3
    [24/Jun/2004:16:22:16][3456.147466][-sched:idle0-]
      Notice: starting
    [24/Jun/2004:16:22:28][3456.163851][-sched:idle1-]
      Notice: starting
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      nsmain: AOLserver/4.0 stopping
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      serv: stopping server: service0
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      serv: connection threads stopped
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      driver: shutdown complete
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      sched: shutdown pending
    [24/Jun/2004:16:22:53][3456.32771][-sched-] Notice:
      sched: shutdown started
    [24/Jun/2004:16:22:53][3456.32771][-sched-] Notice:
      sched: waiting for event threads...
    [24/Jun/2004:16:22:53][3456.163851][-sched:idle1-]
      Notice: exiting
    [24/Jun/2004:16:22:53][3456.147466][-sched:idle0-]
      Notice: exiting
    [24/Jun/2004:16:22:53][3456.32771][-sched-] Notice:
      sched: shutdown complete
    [24/Jun/2004:16:22:53][3456.180227][-shutdown-] Notice:
      nslog: closing '/web/service0/log/service0.log'
    [24/Jun/2004:16:22:53][3456.16384][-main-] Notice:
      nsmain: AOLserver/4.0 exiting"

    it exits at the end cause I press CTRL+D to catch the
    message so that does not matter.

    After that, I can access openacs by port 8000 but not by
    port 80.

Do you know what I might do ???

Thx

Collapse
Posted by Boris Kruvshenko on
I forget to tell I am trying to start OpenACS as root.
Collapse
Posted by Dave Bauer on
You are starting the server on port 8000. See the port line in your configuration file:

set httpport                  8000

Change that to 80.

Dave

Collapse
Posted by Boris Kruvshenko on
well, I have got my config.tcl file with:

    set httpport                  80

then I try to start the openacs as root:

    /usr/local/aolserver/bin/nsd-postgres -it
    /web/service0/etc/config.tcl -u service0 -g web -b 80

and I get the following message in the log file:

    [24/Jun/2004:22:20:59][4380.1075081856][-main-]Error:
        nssock: failed to listen on 192.168.1.3:80:
        Permission denied

I have also try to run openacs without the "-b 80" flag but I get the same log.

I do not know whats wrong.

Collapse
Posted by C. R. Oldham on
But you need to prebind if the server is going to switch and run as another user other than root (and you really want it to run as someone other than root).

Check the -B option.

Collapse
Posted by Orzenil Silva Junior on
Hi Boris,

You are in the right way now! Just follow what DaveB said and change your httpport parameter in your config.tcl to

httpport 80

Also be sure your ip address is correct with you configured network interface

set address                  192.168.1.3

or just try:

set address                  0.0.0.0

Dont forget -b flag. You can start your server as root but just check if it will run under your service0 userid (just type ps auwwx |grep nsd). Also check you are not running other service at port 80, ok?

Why not try daemontools? It is very usefull to keep your service alive.