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

Got a question about our NAS utilities? The answer lies within.
Post Reply
prokium
Posts: 12
youtube meble na wymiar Warszawa
Joined: Wed Jul 29, 2020 2:30 pm

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

Post by prokium »

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.
User avatar
Nazar78
Posts: 2081
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore
Contact:

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

Post by Nazar78 »

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 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response
prokium
Posts: 12
Joined: Wed Jul 29, 2020 2:30 pm

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

Post by prokium »

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
User avatar
Nazar78
Posts: 2081
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore
Contact:

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

Post by Nazar78 »

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 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response
Post Reply

Return to “NAS Utilities”