Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

EDIT: I would like to open 8080 and 1337 ports on my computer, how can I do it? how can I check that the apache server listen on 8080?


For a laboratory work, I am using apache2.2 server, I need to open port 8080 and 1337 on this server, I am told that I need to open it by changing httpd.config file in C:\Program Files\Apache Software Foundation\Apache2.2\conf. I see that I can edit it by opening with notepad. Can anybody tell me what to edit in httpd.config to open these ports?

share|improve this question
4  
You open ports on the firewall. You make Apache listen on specific ports. Please clarify which you want. –  Ben Pilbrow Oct 23 '11 at 13:07
1  
@Johan, please don't take any further advise from the person who told you this. –  John Gardeniers Oct 24 '11 at 1:39
add comment

4 Answers

You want the "listen" directive.

http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen

share|improve this answer
add comment

The Listen directive is what you need. You should have a file called ports.conf in your Apache folder (on Windows) or under /etc/apache2/. If you wanted to configure Apache to listen on ports 8080 and 1337, you'd add:

Listen 0.0.0.0:8080
Listen 0.0.0.0:1337

This would cause Apache to listen on all interfaces. If you just want Apache to listen on a single IP address, you'd add:

Listen 192.168.66.22:8080
Listen 192.168.66.22:1337

To verify Apache listens on that port, you could use a telnet session, like so (assuming 192.168.66.22 is the server's IP address):

telnet 192.168.66.22 8080

If you get some output, the server listens to that port.

share|improve this answer
    
About that telnet, you'd have to type an HTTP request to get any output. Like "GET / HTTP/1.0" + Enter + Enter. And on Windows telnet, you have to type that blind. And without any typo. You can simply point a browser to 192.168.66.22:8080 instead. –  korkman Oct 23 '11 at 21:16
    
Well. As soon as you get a prompt, telnet has successfully connected to the web server. He asked about how to test if a web server listens to that port, not if the web server serves something useful. –  Daniel Oct 24 '11 at 6:32
add comment

In your apache basedir e.g. /etc/apache2 you'll find a ports.conf file. Edit it following the description here -> http://httpd.apache.org/docs/2.2/

besides that you certainly have to add the port settings also to you virtual hosts in order to get them run behind this port...

share|improve this answer
add comment

If you are new to Apache, I recommend using a tool to edit the httpd.conf, rather than messing with the file.

Here is one: http://www.apache-gui.com/apacheconf/index.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.