Fixing nginx “13: Permission Denied” on RHEL 8 with SELinux
Allow nginx to bind to a non-standard port on RHEL 8 by adding the appropriate SELinux port label.
When nginx is configured to listen on a non-standard port such as 1080 on RHEL 8, it may fail with 13: Permission denied. SELinux port labeling is a common cause.
systemd[1]: Starting The nginx HTTP and reverse proxy server...nginx[1626]: nginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx[1626]: nginx: [emerg] bind() to 0.0.0.0:1080 failed (13: Permission denied)nginx[1626]: nginx: configuration file /etc/nginx/nginx.conf test failedsystemd[1]: nginx.service: Control process exited, code=exited status=1systemd[1]: nginx.service: Failed with result 'exit-code'.systemd[1]: Failed to start The nginx HTTP and reverse proxy server.Solution
The fix is to allow nginx to use the custom port 1080 by updating SELinux policies:
sudo semanage port -a -t http_port_t -p tcp 1080If you encounter the error sudo: semanage: command not found, install the required package with these commands:
sudo dnf provides /usr/sbin/semanagesudo dnf install policycoreutils-python-utilsConclusion
Labeling port 1080 as http_port_t with semanage port allows nginx to bind to the non-standard port on RHEL 8.
Although the message resembles a file-permission error, SELinux denies the bind operation when the port is not labeled with a type that nginx may use.
When adding another non-standard listening port on an SELinux-enforcing host, check its SELinux port label before changing file permissions or firewall settings.
Related posts
Configuring nginx Resolver Settings for ELB and Dynamic DNS Backends
Configure nginx to refresh DNS records when proxying to ELB or another backend with changing IP addresses.
Building and Deploying Greengrass Components in a Dockerized Environment
Develop AWS IoT Greengrass components locally using the Greengrass Core Docker image.
Running Proxy.py as a Lightweight HTTP Proxy on EC2
Running Proxy.py on an EC2 instance and reaching it safely through an SSH tunnel, since the proxy has no authentication of its own.
Running MailDev as a Local Mail Server with Docker
Running MailDev in Docker to capture and inspect outgoing mail locally, without a real inbox involved.

Automating AI reviews for Renovate major update PRs
Label Renovate major update PRs with ai-review and trigger AI reviews through GitHub Actions, with a standalone Claude Code workflow example.
