how to open port on apache server

how to open port on apache server

编辑: 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?

答案1

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

答案3

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

答案4

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

相关内容