Page 1 of 1

Assign /admin to port

Posted: 10 Mar 2012, 15:41
by Gunnarsson
Hi


I'm running my bubba the other way around, with the LAN-side to internet. Don't ask why.. long story :)
But I want to open up port 80 to the internet to be able to use the web-server and so on.
Of course i don't want to give access to such services as the /admin page and /music and so on to the internet.
My question:
How do I change the /admin link to a port like localhost:8081 so that I can access it inside my LAN but block the port in my router?

:D

Re: Assign /admin to port

Posted: 10 Mar 2012, 15:56
by Gordon
The obvious solution is to change the listen port in the bubba-vhost definition, but why not do it the other way 'round? If you create a new vhost you can make that listen to an alternative port and have your router forward the regular port 80 to that alternative port (unless your router runs anything that is built by Microsoft, I'm fairly certain it can do that).

Re: Assign /admin to port

Posted: 10 Mar 2012, 16:34
by Gunnarsson
I've tried that but whit no luck.

I added the listen port 8081 in /etc/apache2/ports.conf
and then I just copied the *:80 section in the /etc/apache2/sites-enabled/bubba and renamed it to 8081.
But when i tried to access localhost:8081 I got no response. Im thinking maybe the iptables are blocking port 8081?!

No problem with the router, that was my plan all along :)

Re: Assign /admin to port

Posted: 11 Mar 2012, 04:25
by nobody
First I would check with "apachectl -St" if your setup of port 8081 is actually working.

Re: Assign /admin to port

Posted: 11 Mar 2012, 08:24
by Gunnarsson
nobody wrote:First I would check with "apachectl -St" if your setup of port 8081 is actually working.
apachectl: command not found

Re: Assign /admin to port

Posted: 11 Mar 2012, 11:22
by Gordon
Gunnarsson wrote:
nobody wrote:First I would check with "apachectl -St" if your setup of port 8081 is actually working.
apachectl: command not found
Did you `su` to become root?

Also, I'm not sure how to read the localhost:8081 bit. Are you using something like wget to verify that the server returns a page, or is this the actual URL that you try to reach running your browser? Note that localhost is not an alias for the B3, but refers to the machine your currently working on (in fact it is *my* machine that I'm using this moment to type this message).

Did you restart apache after making the changes to the config file?

Re: Assign /admin to port

Posted: 11 Mar 2012, 11:32
by Gunnarsson
Did you `su` to become root?
Yes.
Also, I'm not sure how to read the localhost:8081 bit. Are you using something like wget to verify that the server returns a page, or is this the actual URL that you try to reach running your browser? Note that localhost is not an alias for the B3, but refers to the machine your currently working on (in fact it is *my* machine that I'm using this moment to type this message).
Sorry for the bad choice of words. I meen the bubba-ip.
So when i type http://bubba-ip:8081/admin i want access to it but when i just type http://bubbaip (port 80 that i want to be able to access from internet) I just want to get access to /home/web/ folder.
Did you restart apache after making the changes to the config file?
Yes.

Re: Assign /admin to port

Posted: 11 Mar 2012, 14:15
by nobody
so it's apache2ctl instead of apachectl. This is different on each linux edition. Next time try to figure this out yourself instead of merely complaining the command yields nothing.

also, download and run nmap to see if anything is listening on 8081.

Code: Select all

apt-get install nmap
nmap -p 80,8081 you.external.ip