(13: Permission denied) while connecting to upstream while configuring Ngnix
This Knowledge Base article was written specifically for the Atlassian Server platform. Due to the Functional differences in Atlassian Cloud, the contents of this article cannot be applied to Atlassian Cloud applications.
While configuring Bitbucket to use Ngnix as a reverse proxy by following Securing Bitbucket Server behind nginx using SSL the following error appears in Ngnix error log:
2016/02/03 17:47:37 [crit] 26894#0: *1 connect() to 127.0.0.1:7990 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.7, server: bitbucket.example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:7990/favicon.ico", host: "bitbucket.example.com", referrer: "http://bitbucket.example.com/"
- Any Linux distribution that ships with SELinux
Check for errors in the SELinux logs:
sudo cat /var/log/audit/audit.log | grep nginx | grep denied
SELinux prevent connections on port 7990 for the nginx process.
Execute the following command in your server:
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx sudo semodule -i mynginx.pp