0

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?

2
  • 4
    You open ports on the firewall. You make Apache listen on specific ports. Please clarify which you want. Oct 23, 2011 at 13:07
  • 1
    @Johan, please don't take any further advise from the person who told you this. Oct 24, 2011 at 1:39

4 Answers 4

2

You want the "listen" directive.

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

2

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.

2
  • 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, 2011 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, 2011 at 6:32
0

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...

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .