Need some Apache2 & Port forwarding help

Cerpin Taxt

Lifer
Feb 23, 2005
11,940
542
126
First things first, I'm a total self-taught noob. That said, I've gotten pretty far along on my own, but now I need some help and I can't find enough info just searching on my own. Here's my situation:

I have 2 ubuntu machines on my network running apache2, whose web pages I want to be able to access from the internet. 1 machine is my MythTV box, and primarily I want to be able to access MythWeb remotely. I'm also running Torrentflux, Webmin, and PhpMyAdmin on that box, and forwarding port 80 to that machine lets me do all that. Each of those is password protected.

Just recently I set up a 2nd box running a headless fileserver with Samba, and I've also installed Torrentflux and PunBB (forum software) on this box (along with Webmin, too). I would like to discontinue using Torrentflux on my MythTV box and instead run it on the fileserver.

I can access everything locally on my network just fine, but it seems like I can only access 1 box or the other from outside my router, depending on which one I forward port 80 to.

I've tried editing /etc/apache2/ports.conf to listen to port 8080, and then forwarding that port to that machine, but for whatever reason, all I get is 404 errors when I try to connect to, for example, http://myipaddress:8080/forums

Can anyone tell me if there are additional configuration files that I need to edit to get my fileserver box to properly listen to port 8080 and then serve me my Torrentflux and PunBB pages? I feel like there's something stupid I'm overlooking and I'm too much of a noob to know what it is. For what it's worth, though, I *DO* know enough to restart my apache server when I change the port it's listening to. :)

Finally, might there be a better way to do this, overall? For example, my router (using DD-WRT) supports VPN, and naturally this would all work while I'm VPN'd into my network, but I'd rather they were publicly accessible, relying on the port differentiation to determine which server I'm accessing, and each application's own password security to restrict access.
 

Cerpin Taxt

Lifer
Feb 23, 2005
11,940
542
126
Well, I think I figured something out.

I guess I don't really need apache2 to listen to a different port. I just set my router to forward port 8080 to port 80 on the fileserver box and it works just fine. Dunno why I didn't think of that earlier. Guess I'm just too nooby. :)

If anyone has any suggestions on how to set it up more cleanly, please feel free to submit them. Otherwise, thanks for reading anyway. :)
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
What you have is going to be the easiest to work with IMO.

You were on the right path before though, the only left for you to configure would have been your virtual hosts. By default your websites that are being hosted by apache are stored in /etc/apache2/sites-available/

They are then symbolically linked to /etc/apache2/sites-enabled/ after you run a2ensite <website_name>.

Each of those files will contain the definition of one of your virtual hosts, they should start with a directive like
<VirtualHost *:80>
...
</VirtualHost>

That tells apache to host that virtual server on every IP on port 80. Once you add port 8080 to /etc/apache2/ports.conf you need to change the virtual hosts to listen on that port as well.

 

Cerpin Taxt

Lifer
Feb 23, 2005
11,940
542
126
Originally posted by: Crusty
What you have is going to be the easiest to work with IMO.

You were on the right path before though, the only left for you to configure would have been your virtual hosts. By default your websites that are being hosted by apache are stored in /etc/apache2/sites-available/

They are then symbolically linked to /etc/apache2/sites-enabled/ after you run a2ensite <website_name>.

Each of those files will contain the definition of one of your virtual hosts, they should start with a directive like
<VirtualHost *:80>
...
</VirtualHost>

That tells apache to host that virtual server on every IP on port 80. Once you add port 8080 to /etc/apache2/ports.conf you need to change the virtual hosts to listen on that port as well.

See that's the kinda stuff I wouldn't know, and was unable to uncover with my own searching.

Thanks, Crusty. I'm going to leave it like I have it, anyway, but at least I learned something new that I can use later, if I need it.
 

Cerpin Taxt

Lifer
Feb 23, 2005
11,940
542
126
By the way, did anyone else know that MythWeb has a built-in default page format for mobile browsers? I can program TV recordings from my phone! :cool:
 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81
but if he's not running virtualhost that wont work. you need to modify the port in apache2.conf to point to port 8080