Topic: Permission Issues; 502 Bad Gateway
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4.2
- Deployed with iRedMail Easy or the downloadable installer? Downloadable Installer
- Linux/BSD distribution name and version: FreeBSD 13.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
I just completed an install of iRedMail on a FreeBSD jail. The jail has its own public IP address that isn't used by the host. After installing iRedMail and restarting the jail, I get a 502 Bad Gateway error when trying to visit mail.myserver.com/mail or mail.myserver.com/iredadmin.
I don't think it's a jail networking issue—I have another jail that can run Apache just fine on a different IP (but I shut it off just in case to test this). The nginx log file shows the following:
2021/11/21 00:39:08 [crit] 2403#100617: *24 connect() to 127.0.0.1:7791 failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: _, request: "GET /iredadmin/ HTTP/2.0", upstream: "uwsgi://127.0.0.1:7791", host: "mail.mydomain.net"
2021/11/21 00:35:34 [crit] 1132#100541: *15 connect() to 127.0.0.1:9999 failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: _, request: "GET /mail/ HTTP/2.0", upstream: "fastcgi://127.0.0.1:9999", host: "mail.mydomain.net"
I noticed that the 'iredadmin' folder in 'www' was owned by root so I changed it the owner to 'iredadmin,' which was the owner of the 'iRedAdmin-1.5' folder but this didn't resolve anything. I didn't want to experiment with the permissions too much for security reasons so my next step was to reach out here. The 'roundcube' folder also shows that it's owned by root.
In my /usr/local/bin folder uwsgi and uwsgi-3.8 exist. fastcgi_params and uwsgi_params both exist in /usr/local/etc/nginx.
I apologize if I'm overlooking something obvious. This is my first time fiddling with nginx and I'm still learning.