Author Topic: 502 Bad Gateway  (Read 9183 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
502 Bad Gateway
« on: March 10, 2022, 05:15:44 AM »
Hello,

I have installed PHP-FPM and changed my webserver from Apache to either Nginx or Nginx + Varnish Cache. However, I am receiving a 502 Bad Gateway message for my website, which is the initial installation of WordPress.

I have selected the latest version of PHP, which is something like 7.4.28.

May you please help me?

Thanks!

Offline
****
Re: 502 Bad Gateway
« Reply #1 on: March 10, 2022, 05:26:57 AM »
Please make sure you have a pro license, or any verison of FPM will be disabled automatically.  If you do have pro, make sure you start the PHP-FPM service

systemctl start php-fpm74
systemctl enable php-fpm74
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: 502 Bad Gateway
« Reply #2 on: March 10, 2022, 05:49:23 AM »
Please make sure you have a pro license, or any verison of FPM will be disabled automatically.  If you do have pro, make sure you start the PHP-FPM service

systemctl start php-fpm74
systemctl enable php-fpm74

I am happy to say that I am now using the pro version.



However, I only see the following even after enabling PHP-FPM


Offline
****
Re: 502 Bad Gateway
« Reply #3 on: March 10, 2022, 06:01:10 AM »
You may need to rebuild your configs after enabling fpm
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: 502 Bad Gateway
« Reply #4 on: March 10, 2022, 06:58:00 AM »
You may need to rebuild your configs after enabling fpm

I found the issue. I tried to explore these first:



I honestly don't know the difference between the two.

Moving forward, I checked the User Accounts > List Accounts and I noticed the Domain Name has a missing .com that is why it does not work. I fixed it by deleting and recreating the User Account again.
To my surprise, it worked. To be sure, I did the Fix Permissions stuff and Web Server Settings > Web Servers Main Conf / Web Servers Domain Conf.

Finally, it worked!

Offline
****
Re: 502 Bad Gateway
« Reply #5 on: March 10, 2022, 07:09:57 AM »
Main config is for ALL of your accounts that don't have specific configurations.  Domain Config allows you to use a different template for an individual account, or domain.  Once you explore some more, you will get the hang of it.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: 502 Bad Gateway
« Reply #6 on: March 10, 2022, 08:51:06 AM »
Main config is for ALL of your accounts that don't have specific configurations.  Domain Config allows you to use a different template for an individual account or domain.  Once you explore some more, you will get the hang of it.

I thought it was something that would be mandatory for domains to have. At least now I know. I don't wholly understand the template's purpose, but I think either I will use default or php-fpm as the template, right?

Offline
****
Re: 502 Bad Gateway
« Reply #7 on: March 10, 2022, 12:09:50 PM »
Main config is for ALL of your accounts that don't have specific configurations.  Domain Config allows you to use a different template for an individual account or domain.  Once you explore some more, you will get the hang of it.

I thought it was something that would be mandatory for domains to have. At least now I know. I don't wholly understand the template's purpose, but I think either I will use default or php-fpm as the template, right?

Yes.  Set the Main config to Default is fine.  I

As to the Domain Configs, let's say you have a Joomla site, that requires specific settings from apache or nginx.  You can create a new template with those specific settings, and set that domain to use it.  NEVER edit the config files directly, because any changes made can be overwritten on an update of CWP, or a config rebuild
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: 502 Bad Gateway
« Reply #8 on: March 10, 2022, 04:07:32 PM »
Main config is for ALL of your accounts that don't have specific configurations.  Domain Config allows you to use a different template for an individual account or domain.  Once you explore some more, you will get the hang of it.

I thought it was something that would be mandatory for domains to have. At least now I know. I don't wholly understand the template's purpose, but I think either I will use default or php-fpm as the template, right?


Yes.  Set the Main config to Default is fine.  I

As to the Domain Configs, let's say you have a Joomla site, that requires specific settings from apache or nginx.  You can create a new template with those specific settings, and set that domain to use it.  NEVER edit the config files directly, because any changes made can be overwritten on an update of CWP, or a config rebuild

Thank you!

I activated the AutoSSL feature through Let's Encrypt.
Now I always receive a 403 Forbidden message.
I changed the type of web server from nginx + Varnish Cache to nginx only, vice-versa.

I am still receiving a 403 message whenever I visit my site both SSL and non-SSL version of it.

Offline
****
Re: 502 Bad Gateway
« Reply #9 on: March 10, 2022, 05:02:01 PM »
403 errors typically means that you have permission issues.  make sure directories are chmod 755, and files 644 in your web roots.  Also make sure the files are owned by the user
Google Hangouts:  rcschaff82@gmail.com

Offline
***
Re: 502 Bad Gateway
« Reply #10 on: March 10, 2022, 05:28:54 PM »
Code: [Select]
I am still receiving a 403 message whenever I visit my site both SSL and non-SSL version of it.
Do you have mod_security enabled by any chance? It may be blocking a script that runs when you visit the page?
Either way, 403 message is usually user related. Meaning you added something that's blocking you.

Offline
*
Re: 502 Bad Gateway
« Reply #11 on: March 11, 2022, 03:08:57 AM »
Code: [Select]
I am still receiving a 403 message whenever I visit my site both SSL and non-SSL version of it.
Do you have mod_security enabled by any chance? It may be blocking a script that runs when you visit the page?
Either way, 403 message is usually user related. Meaning you added something that's blocking you.

Yes, I have mod_security enabled.
Also, the 403 message started to appear when I used AutoSSL and received the Let's Encrypt certificate.

Offline
****
Re: 502 Bad Gateway
« Reply #12 on: March 11, 2022, 04:01:06 AM »
you should also check the /usr/local/apache/domlogs/  for both the access and error logs.  They should give some insight as to why you are receiving 403 errors.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: 502 Bad Gateway
« Reply #13 on: March 11, 2022, 06:13:11 AM »
you should also check the /usr/local/apache/domlogs/  for both the access and error logs.  They should give some insight as to why you are receiving 403 errors.

I am mainly using nginx.

Offline
*
Re: 502 Bad Gateway
« Reply #14 on: March 11, 2022, 09:43:08 AM »
I have removed the AutoSSL thing, and it still says 403 Forbidden. The website would work if I tried using simply Apache or nginx + Varnish + Apache. I decided to use CWP Pro to install php-fpm[/] and avoid Apache altogether. Any thoughts about why making nginx the primary server does not work? Thanks.