Bootstrap FreeKB - Nginx (Web Server) - Listen Port
Nginx (Web Server) - Listen Port

Updated:   |  Nginx (Web Server) articles

After a clean install of Nginx, navigate to http://<ip address or hostname>, the default page should be displayed. Notice in this example that no port was included in the URL.


This is because, by default, /etc/nginx/nginx.conf is listening on port 80

[root@server1 ~]# cat /etc/nginx/nginx.conf
. . .
server {
  listen       80 default_server;
  listen       [::]:80 default_server;
. . .


Let's say you want to use some other port. This can be done by specifying some unused port, such as 18080.

[root@server1 ~]# cat /etc/nginx/nginx.conf
. . .
server {
  listen       18080 default_server;
  listen       [::]:18080 default_server;
. . .


You should then be able to request the web page by including the port in the URL, such as http://<ip address or hostname>:18080.


Be aware that if SELinux is enabled on the system, SELinux may be configured to only allow certain ports for HTTP

Refer to SELinux is preventing nginx from name_bind access on the tcp_socket port <port>.

~]# semanage port -l | grep ^http_port_t
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

Please enter ff90ca in the box below so that we can be sure you are a human.