Posted On March 31, 2019

Error: 502 Gateway Error

kimconnect 0 comments
blog.KimConnect.com >> Codes , Linux >> Error: 502 Gateway Error
Explanation:
502 Gateway Error generally means connection problems with an upstream proxy. In this instance, Apache is the upstream to NGINX.
 
Troubleshooting steps:
1. Test Apache directly to see that it can host from such ports
curl -I
#####
HTTP/1.1 200 OK
#####
 
2. Check NGINX error log
tail /var/log/nginx/error.log
#####
2019/02/01 23:20:18 [crit] 21974#21974: *7 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: xx.xx.xx.xx, server: kimconnect.com, request: “GET /info.php HTTP/1.1”, upstream: “http://127.0.0.1:8080/info.php”, host: “kimconnect.com”
#####
 
3. Check SELinux logs
cat /var/log/audit/audit.log | grep nginx | grep denied
#####
type=AVC msg=audit(1549092018.112:22234): avc:  denied  { name_connect } for  pid=21974 comm=”nginx” dest=8080 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_cache_port_t:s0 tclass=tcp_socket permissive=0
#####
 
Resolution:
# Configure SELinux to allow httpd to connect to nginx
setsebool -P httpd_can_network_connect 1
# Make rule permanent
setsebool httpd_can_network_connect on -P

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Hyper-V Set CompatibilityForMigrationEnabled

$vmName='TESTVM' function enableCpuCompatibility($vmName){ $compatibilityForMigration=(Get-VMProcessor $vmName).CompatibilityForMigrationEnabled if(!$compatibilityForMigration){ $vmIsRunning=(get-vm $vmname).State -eq 'Running' if($vmIsRunning){stop-vm $vmName} Set-VMProcessor$vmName -CompatibilityForMigrationEnabled 1…

How to Enforce Keyboard Layout Consistency for Remote Desktop

# The following function will allow the RDP session to store the user keyboard language…

Install Apps on Remote Computers via WinRM & Chocolatey

Version A: [string[]]$computers=@( 'SERVER01', 'SERVER02', 'SERVER03' ) [string]$chocoAppName='pgadmin4' [version]$minVersion='6.0' $results=[hashtable]@{} foreach ($computer in $computers){ $session=new-pssession…
Other project: DragonCoin.com