While nobody responded yet, let me add that I did one thing outside forge to rectify this issue I restarted instance in AWS console which obviously changed my IP, but I have changed it to proper value in forge changed DNS records and gained control over SSH back as mentioned above but default page still redirects to old IP which is now taken by different user, is there a way to reset it? I can connect to my server on new IP via ssh but http redirects on all devices to old IP.
Forge 502 Bad Gateway after server restart
Hi everyone, I am struggling with small glitch in Forge/AWS configuration. Please note I don't change any configuration files except .env. So if I "accidentally" or on purpose click "restart server" or "restart nginx service" I get 502 Bad Gateway nginx/1.9.14 I can ssh to the server straight away after restart but the application hosted on the server is not reachable from the server itself. Curl returns 502 as well. After reading most of the "502" posts I gave up and went back to DigitalOcean, but don't want to lose substantial credit value I have on AWS. It happened already 3 times, what is interesting that server is back after period of time, last time it was 3 hours after, maybe server heals itself ;) Could you direct me where to look for, what I think Nginx configuration issue is, to resolve it.
I had the same problem, it was pretty obvious after checking that error line that the site was looking for a non-existent version of PHP. I guess Forge is defaulting to a PHP 7 configuration because that's what it installs when it spins up a new server. Unfortunately it doesn't seem to care if an existing server runs PHP 5 when it creates a new site. There may be a setting for this in Forge but I haven't found one.
Anyway, the simple fix for me was to go to the nginx config in:
Forge > [my server] > [mydomain.com] > Edit Files > Edit Nginx Configuration
or in a terminal...
sudo nano /etc/nginx/sites-available/mydomain.com
and change the fastcgi_pass value from unix:/var/run/php/php7.0-fpm.sock to unix:/var/run/php5-fpm.sock as follows:
location @fallback {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock; # changed from /var/run/php/php7.0-fpm.sock
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root;
include fastcgi_params;
}
Please or to participate in this conversation.