How to listen to a certain port

November 15, 2017 224 views
Apache

Hi. I have an Apache Server with a LAMP Stack running on Ubuntu 14.04.

It's all set up well, but I also need to monitor messages coming in from Port 22. I've opened the port using ufw, but I don't know how to listen to it.

Any help will be very much appreciated.

1 Answer

Port 22 is generally used for SSH traffic. If you configure another application besides the SSH daemon to listen on that port, make sure to configure SSH to listen on a different port first. If not, you may lose access to the server.

If you really want to configure Apache to listen to port 22, you must add or edit a VirtualHost to do so as well as configure a Listen directive. The port that Apache will respond on is configured

Listen 22

<VirtualHost *:22>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

For more information on configuring Apache, check out:

To learn more about SSH, see:

SSH, or secure shell, is the most common way of connecting to and administering remote Linux servers. In this cheat sheet-style guide, we'll cover some of the basic options and configuration sets you may want to use.
Have another answer? Share your knowledge.