Ubuntu - How to open ports 80, 443 for Apache web server

Ubuntu - How to open ports 80, 443 for Apache web server

Hello colleagues.

After installing your Apache web server on the Ubuntu operating system, do not think that it will immediately be available from outside your server. By default, all ports on your server are closed and your Apache web server is no exception, and in order for your web server to be available on the Internet, we need to open special ports and protocols that Apache uses. First you need to open port 80 (http), and then when you set up an SSL certificate, you still need to open port 443 (https).

The Ubuntu server comes with a firewall configuration tool called ufw by default. The ufw tool is very easy to use and configure firewall rules, and with it we will be opening ports for Apache.

 

First, let's check the current state of our firewall (Firewall) using the command:

$. sudo ufw status verbose

apache open port 80, 443

As you can see from the screenshot, we have a registered Apache application, but it now has a DENY IN prohibition rule, which means that all incoming ports to our Apache are blocked.


 

Now let's open access to our Apache web server. We have several options on how to open ports  80 and 443.

The first option is to simply specify the port numbers that we are using the Apache web server.

$. sudo ufw allow 80

$. sudo ufw allow 443

The second option is to open Apache http and https protocols.

$. sudo ufw allow http

$. sudo ufw allow https


 

Another option, if we want to open the Apache profile, for this we follow the following command:

$. sudo ufw allow 'Apache Full'


 

After our changes, we need to check the status of the firewall (Firewall).

$. sudo ufw status verbose

apache open port 80, 443

As you can see, now the Apache Full profile has action ALLOW, which means that our Apache web server can be accessed via ports 80 and 443.


 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES

How to Install Galera Cluster Manager on Centos

How to Install Galera Cluster Manager on Centos

PROGRAMS
Apache - How to find web server log files: access log, error log

Apache - How to find web server log files: access log, error log

PROGRAMS
Apache - Process Management: start, stop, reload

Apache - Process Management: start, stop, reload

PROGRAMS