LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-08-2010, 07:06 AM   #1
fbgp2000
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Rep: Reputation: 0
Define Apache New Port


First of all, I have to say that I'm a beginner in Linux. Sorry if I ask any dummy question.

I have run apache on my server and I have been using this web service as my programming test server (Apache/PHP/MySQL). During this time, Apache has been using port 80 as the default and only available port for http.

Right now, I need to let other coders to access this server remotely through a valid IP. Because my ISP has blocked port 80, I have decided to make apache available on another port as well as 80. To do so, I checked the Internet and noticed that just one line should be added to http.conf and that is:
Listen 8000

So I added this line bellow the line "Listen 80" and then restarted httpd service. But the result was not as I expected. Port 80 did work perfectly but port 8000 is not working while calling the address 192.168.1.5:8000.

What I have checked or tested till now are as bellow:

- I thought maybe I was editing a wrong http.conf file. So I commented the line "Listen 80". If the file was a wrong one, then I could browse my server without that line. But the httpd server went down and that proves the file is not a fake.

- Each time when I changed the port and restarted apache, I used telnet command from windows OS on both 80 and 8000 ports. Port 80 responded correctly to telnet command but respond for port 8000 was as bellow:
Connecting to 192.168.1.5... Could not open connection to the host, on port 8000: Connection failed

- I checked my client to ensure that port 8000 is not being blocked by my personal firewall and I'm sure it's not blocked by a personal firewall.

- There is no firewall installed on my windows servers. As far as I know, there is no firewall installed on my Linux Coding Server either. I say "as far as I know" because I'm not fluent in Linux. But I checked if IPTables is installed on this server, and it wasn't. I don't think there is any other kind of firewall installed on this server because I installed the OS on this server by myself and I didn't install any firewall. But I'm not sure if there were any firewalls in the typical install routine.

Does anybody guess what could go wrong in my system?
 
Old 05-08-2010, 07:22 AM   #2
fbgp2000
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Extra Information

I checked the being listened ports with the command of "netstat -nlp" and the answer shows that httpd is listening to port 8000 (and 8081 and 5000 which I added them all):

tcp 0 0 :::8000 :::* LISTEN 3644/httpd
tcp 0 0 :::5000 :::* LISTEN 3644/httpd
tcp 0 0 :::80 :::* LISTEN 3644/httpd
tcp 0 0 :::8081 :::* LISTEN 3644/httpd

But, still I can not telnet to the server on ports 8081, 8000 and 5000. I also can not open 192.168.1.5 on the 3 mentioned ports (But I can open it on port 80).

Quote:
Originally Posted by fbgp2000 View Post
First of all, I have to say that I'm a beginner in Linux. Sorry if I ask any dummy question.

I have run apache on my server and I have been using this web service as my programming test server (Apache/PHP/MySQL). During this time, Apache has been using port 80 as the default and only available port for http.

Right now, I need to let other coders to access this server remotely through a valid IP. Because my ISP has blocked port 80, I have decided to make apache available on another port as well as 80. To do so, I checked the Internet and noticed that just one line should be added to http.conf and that is:
Listen 8000

So I added this line bellow the line "Listen 80" and then restarted httpd service. But the result was not as I expected. Port 80 did work perfectly but port 8000 is not working while calling the address 192.168.1.5:8000.

What I have checked or tested till now are as bellow:

- I thought maybe I was editing a wrong http.conf file. So I commented the line "Listen 80". If the file was a wrong one, then I could browse my server without that line. But the httpd server went down and that proves the file is not a fake.

- Each time when I changed the port and restarted apache, I used telnet command from windows OS on both 80 and 8000 ports. Port 80 responded correctly to telnet command but respond for port 8000 was as bellow:
Connecting to 192.168.1.5... Could not open connection to the host, on port 8000: Connection failed

- I checked my client to ensure that port 8000 is not being blocked by my personal firewall and I'm sure it's not blocked by a personal firewall.

- There is no firewall installed on my windows servers. As far as I know, there is no firewall installed on my Linux Coding Server either. I say "as far as I know" because I'm not fluent in Linux. But I checked if IPTables is installed on this server, and it wasn't. I don't think there is any other kind of firewall installed on this server because I installed the OS on this server by myself and I didn't install any firewall. But I'm not sure if there were any firewalls in the typical install routine.

Does anybody guess what could go wrong in my system?
 
Old 05-08-2010, 05:32 PM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
All you need to do is in httpd.conf change

Listen 80

to

Listen 8000 or Listen 192.168.1.5:80000

and then restart Apache. That should have Apache listening on port 8000. However, be sure that you only have one active Listen line in httpd.conf.
 
Old 05-09-2010, 04:46 AM   #4
fbgp2000
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Unhappy It didn't work

Thank you Hangdog42.

I commented the line reading "Listen 80" and all the other lines mentioning port numbers. Then I wrote a line reading "Listen 8000". Then I restarted apache. But it didn't work. Then I restarted my Linux server. It didn't work again.

I'm realy too confused and don't know what to do.

Any other suggestions?
 
Old 05-09-2010, 05:14 AM   #5
fbgp2000
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 0
netstat

As I mentioned before, when I enable the both ports of 80 and 8000 in apache, netstat reports that linux is listening to these two ports. Output of netstat is as bellow:

tcp 0 0 :::8000 :::* LISTEN 3010/httpd
tcp 0 0 :::80 :::* LISTEN 3010/httpd


Quote:
Originally Posted by fbgp2000 View Post
Thank you Hangdog42.

I commented the line reading "Listen 80" and all the other lines mentioning port numbers. Then I wrote a line reading "Listen 8000". Then I restarted apache. But it didn't work. Then I restarted my Linux server. It didn't work again.

I'm realy too confused and don't know what to do.

Any other suggestions?
 
Old 05-09-2010, 07:48 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
I commented the line reading "Listen 80" and all the other lines mentioning port numbers.
You don't want to go randomly commenting lines just because they mention a port number. The Listen directive is what Apache uses to determine which port it should listen to, so if you've changed other directives, you may have inadvertently caused other problems. If I were in your shoes, I'd take the stock httpd.conf and change just the Listen line and restart Apache. If it doesn't work, you need to start digging in the log files of your server (usually in /var/log) and see what Apache is complaining about.

Also, when you say "it doesn't work", what exactly do you mean? Are you still using telnet or are you trying to connect through a browser? The browser is more likely to give some useful information.
 
Old 05-21-2010, 04:25 PM   #7
yahazee
LQ Newbie
 
Registered: May 2010
Posts: 1

Rep: Reputation: 0
maybe you have blocked ports?
Check the firewall configuration.
 
Old 05-21-2010, 07:18 PM   #8
LVsFINEST
Member
 
Registered: Aug 2006
Posts: 99

Rep: Reputation: 21
I don't think you'd be able to get Apache running if it didn't like your config. Your netstat output even shows the daemon listening on 8000. I really want to say you do have IPtables on this box... What distro are you using?

These may be helpful:

To list iptable rules:
/usr/sbin/iptables -L
or
/sbin/iptables -L

To disable iptables (RHEL based systems):
service iptables stop
 
Old 05-21-2010, 07:22 PM   #9
LVsFINEST
Member
 
Registered: Aug 2006
Posts: 99

Rep: Reputation: 21
Quote:
Originally Posted by Hangdog42 View Post
All you need to do is in httpd.conf change

Listen 80

to

Listen 8000 or Listen 192.168.1.5:80000

and then restart Apache. That should have Apache listening on port 8000. However, be sure that you only have one active Listen line in httpd.conf.
Port 80000? My brain just exploded.
 
Old 05-22-2010, 07:56 AM   #10
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by LVsFINEST View Post
Port 80000? My brain just exploded.

Shhhhhh. It is a new super-secret port the bad guys don't know about yet. It can only be accessed via fat-fingered typing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Define port in DNS record? jakev383 Linux - Server 2 10-07-2008 12:53 PM
Configuring Automatic Redirects from port 80 to port 443 with bundled Apache server kaplan71 Fedora 1 12-28-2007 08:30 AM
If i change my apache port 80 to another port, can this affect google listings? Doomhammer Linux - Networking 4 03-16-2007 08:41 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:44 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