LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Define Apache New Port (https://www.linuxquestions.org/questions/linux-networking-3/define-apache-new-port-806636/)

fbgp2000 05-08-2010 07:06 AM

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?

fbgp2000 05-08-2010 07:22 AM

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 (Post 3961259)
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?


Hangdog42 05-08-2010 05:32 PM

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.

fbgp2000 05-09-2010 04:46 AM

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?

fbgp2000 05-09-2010 05:14 AM

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 (Post 3961981)
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?


Hangdog42 05-09-2010 07:48 AM

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.

yahazee 05-21-2010 04:25 PM

maybe you have blocked ports?
Check the firewall configuration.

LVsFINEST 05-21-2010 07:18 PM

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

LVsFINEST 05-21-2010 07:22 PM

Quote:

Originally Posted by Hangdog42 (Post 3961685)
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.

Hangdog42 05-22-2010 07:56 AM

Quote:

Originally Posted by LVsFINEST (Post 3977133)
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.


All times are GMT -5. The time now is 08:22 AM.