How to listen to a certain port

  • Posted November 15, 2017
  • 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.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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

For more information on configuring Apache, check out:

To learn more about SSH, see: