It is currently Thu Nov 26, 2020 9:04 am
All times are UTC + 8 hours

[SOLVED][Chroot] kill 80->8000 redirect and startup apache2 is not as chroot

Got a question about our NAS utilities? The answer lies within.

[SOLVED][Chroot] kill 80->8000 redirect and startup apache2 is not as chroot

Postby prokium » Tue Aug 18, 2020 5:45 pm

Hi,

So, after that i have installed a debian as chroot, i have started to install and configure bind9.
That works perfectly to resolve some hosts in my local network.

So after that, i would like to install my an apache2 with chroot.
I dont want to use the one of the nas because i need to install some deps that if think will not be in the nas by default and will be may be quiet hard to install (https://asciimoo.github.io/searx/admin/ ... tion-basic).

So, I have installed apache2 and, now, I would like to start apache2 so my script is below :
Code: Select all
chroot $FULL_PATH /etc/init.d/bind9 start
/etc/init.d/S41lighttpd stop
chroot $FULL_PATH /etc/init.d/apache2 start


We can see that bind9 is starting and started well, but that apache2 is not. It looks like the 80 port is currently in used by the nas
Code: Select all
[ ok ] Starting domain name service...: bind9.
Stopping lighttpd...
[....] Starting Apache httpd web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.139.1.42. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
. ok


When I am doing a netstat :
Code: Select all
admin@AS6102T-C545:/volume1/home/admin $ netstat -a | grep 80
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN     
tcp        0      0 :::8000                 :::*                    LISTEN     
tcp        0      0 :::8001                 :::*                    LISTEN

So i see well the https/http of the adm.

But, this is quiet interresting :
Code: Select all
admin@AS6102T-C545:/volume1/home/admin $ netstat -a | grep www
tcp        0      0 0.0.0.0:www             0.0.0.0:*               LISTEN
admin@AS6102T-C545:/volume1/home/admin $ netstat -a | grep http
tcp        0      0 0.0.0.0:https           0.0.0.0:*               LISTEN


Does it mean that the 80 port is used?

How can i start my chrooted apache2 ?
Thx
Last edited by prokium on Tue Aug 18, 2020 9:14 pm, edited 1 time in total.
prokium
 
Posts: 11
Joined: Wed Jul 29, 2020 2:30 pm

Re: [Chroot] Bind9 is working, apache2 is not as chroot

Postby Nazar78 » Tue Aug 18, 2020 7:34 pm

Port 80 is taken by ADM's myhttpd:
Code: Select all
sudo netstat -natp|grep -E ':80\s.+LISTEN'
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3084/myhttpd

So you'll need to change the chroot's apache2 listening port to other than 80 or bind IP to another available interface in /etc/apache2/ports.conf.
AS5304T - 16GB DDR4 - [40TB N300 RAID10 + 5 Bay USB: 8TB RAID5 & 480GB SSD for Apps]
User avatar
Nazar78
 
Posts: 195
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Re: [Chroot] kill 80->8000 redirect and startup apache2 is not as chroot

Postby prokium » Tue Aug 18, 2020 8:52 pm

First, thx for your help.

So, you mean that is not possible to disable the listener that is just redirecting the 80,443 -> 8000,8001?
I have check many files on the nas, and for the moment I have found nothing about this redirection.


Edit : ok I "succeed" to start the apache2 chrooted with the adm. It must be cleaner but the idea is below.
sudo /usr/bin/pkill /usr/sbin/myhttpd
sudo chroot debian/path /etc/init.d/apache2 start
prokium
 
Posts: 11
Joined: Wed Jul 29, 2020 2:30 pm

Re: [SOLVED][Chroot] kill 80->8000 redirect and startup apache2 is not as chroot

Postby Nazar78 » Tue Aug 18, 2020 9:35 pm

NP. The usual workaround, like what you did, is to kill the process using the default port before claiming it with another process. You'll have to do this every reboot also IIRC ADM will try to start this process after sometime.

For me, I just change the chroot httpd (Nginx) ports because I'm using vhosts and my router is forwarding the external ports 80/443 to the chroot 1080/1443. Works for both web and reverse proxy.
AS5304T - 16GB DDR4 - [40TB N300 RAID10 + 5 Bay USB: 8TB RAID5 & 480GB SSD for Apps]
User avatar
Nazar78
 
Posts: 195
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Return to NAS Utilities

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest

cron