LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2013, 05:59 PM   #1
iceman81
Member
 
Registered: Jan 2013
Location: New Jersey
Distribution: CentOS, Arch
Posts: 181

Rep: Reputation: Disabled
port forwarding for apache


i just set up an apache server, and after it was all said and done i find out my isp blocks port 80 and 8080. i am using no-ip.org to redirect to port 8181. however i can't get apache to accept "listen" on any ports other than 80 and 8080. so my question is, can i forward the port in my router to come in at 8181 and switch to 80 to the linux box ip (192.168.1.7) or should i just forward 8181 to it and redirect it in my firewall or through some other method like tomcat ex:

iptables -t nat -A PREROUTING -p tcp --dport 8181 -j REDIRECT --to-port 80

also if i do a netstat it doesn't show that i am actively listening on that port(8181) so i guess i would have to open it up somehow...

it seems like i am almost there, i just need alittle nudge to get me over the hill.

ps, i'm getting the error "can't bind 8181 no listening sockets available
 
Old 02-16-2013, 08:27 PM   #2
joecam1673
LQ Newbie
 
Registered: Aug 2009
Location: Chicago, IL
Distribution: Debian
Posts: 15

Rep: Reputation: 2
Well, you could go about this a number of ways. Your router might be an option. Generally they'll allow public and private ports. In that instance you could set the public port to 8181(or whatever you want) and your private port to 80 and leave your internal config the way it is.

Changing the listening port on apache is easily done by editing your ports.conf file. Where that is depends on what version of apache and/or what distro you're running but either /etc/apache2 or /etc/httpd are pretty safe bets.

"Listening 80" would be changed to "Listening 8181" and then reloading apache "/etc/init.d/apache2 reload" or "/etc/init.d/httpd reload" will load your config changes.

A quick "netstat -napt | egrep -i 'apache|http'" should reveal your listening on the new port.

Hope that helps.
 
Old 02-16-2013, 08:52 PM   #3
iceman81
Member
 
Registered: Jan 2013
Location: New Jersey
Distribution: CentOS, Arch
Posts: 181

Original Poster
Rep: Reputation: Disabled
I did not realize in the port forwarding section of my router that there was a check box to allow internal and external port to be different. Works like a charm now. Although i was not aware of the ports.conf i was only editing httpd.conf. thanks for the response
 
Old 02-17-2013, 03:18 AM   #4
joecam1673
LQ Newbie
 
Registered: Aug 2009
Location: Chicago, IL
Distribution: Debian
Posts: 15

Rep: Reputation: 2
Happy to help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache on Kubuntu / Port forwarding bsctov Linux - Networking 8 04-29-2008 04:15 PM
apache port forwarding. sraju Linux - Server 5 10-26-2006 06:16 AM
Apache port forwarding kg4ysy Linux - Software 2 06-14-2006 01:57 PM
Port Forwarding for Apache IlyaZ Linux - Networking 14 05-15-2005 04:41 AM
seperate apache, port forwarding kires Linux - General 2 04-24-2002 12:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration