Nginx Error is Resulting in 502 Bad Gateway - php

I have an AWS EC2 instance which is running Ubuntu. When I go into my error logs I have this one right here. What does this mean and how can I fix it?
This is from my error.log file:
2019/09/05 18:01:02 [crit] 991#991: *46 connect() to unix:/var/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 64.223.223.8, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "thewildwear.com"

Your Nginx server not able to communicate with php7.2-fpm either the path /var/run/php/php7.2-fpm.sock is not valid or the php7.2-fpm is not running.
Check if PHP is running.
sudo systemctl status php7.2-fpm
verify the path if it existls -l /var/run/php/php7.2-fpm.sock
If not exist then try to find the exact file under php cd /var/run/php/ and ls you will see
php7.*-fpm.pid php7.*-fpm.sock
update the /etc/nginx/sites-available/default and changed "fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;" line to "fastcgi_pass unix:/var/run/php/php7.{after ls}-fpm.sock;".
You can check this GitHub issue and here.

Related

I unmasked my php-8.0-fpm service and now I get 502

After running systemctl unmask php8.0-fpm to be able to restart the php8.0-fpm my website start responding with a 502 code, the unmask command returned this output:
Removed /etc/systemd/system/php8.0-fpm.service.
I got this on my logs *16 connect() to unix:/var/run/php/php8.0-fpm.sock failed (2: No such file or directory) while connecting to upstream.
I think my server was configured like suggested in this website https://ispire.me/running-php-fpm-with-different-user-group-using-umask/, but right now i dont have the php8.0-fpm.service on the /lib or the /etc since the unmask command removed this file.

13: Permission denied php 5.6 fpm on ubuntu 14.06 with nginx

I am not able to run php fpm on nginx. I am getting permission error with www-data user/group. My error log is as below. I tried giving permission to the user www-data with different solutions over internet but didnt worked. I am running codeingiter framework. Please check error log below
10673#10673: *19456 stat() "/var/www/html/testphp/api/ajax/getdetails" failed (13: Permission denied), client: 11.11.1.11, server: www.mydomain.com, request: "GET /api/ajax/getroomdetails/201 HTTP/1.1", h$
10673#10673: *19456 stat() "/var/www/html/testphp/api/ajax/getdetails" failed (13: Permission denied), client: 11.11.1.11, server: www.mydomain.com, request: "GET /api/ajax/getroomdetails/201 HTTP/1.1", h$
10673#10673: *19456 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 11.11.1.11, server: www.mydomain.com, request: "GET /api/ajax/getdetails HTTP/1.1$
Please suggest how can I give correct permissions to run php-fpm
have you checked your file permissions
cd /you Directory
then type
ls -l
after that you can use
chown -R root:www-data /Directory
chmod g+w -R /Directory
or
chmod +x /Directory

Valet: 502 bad gateway when running test.dev on a mac, laravel, php install

I installed locally php71 with fpm on a mac.
Then got valet working when going to 'ping anyting.dev'.
Then went into directory 'PHP_Apps' where I have all my php apps installed and ran 'valet park' in that directory. Inside it I created a 'test' directory containing an index.php file.
Going in the browser to index.dev displays:
502 Bad Gateway nginx/1.10.2
Also the log file records:
2017/01/31 16:58:48 [crit] 285#0: *16 connect() to
unix:/Users/ME/.valet/valet.sock failed (2: No such file or directory)
while connecting to upstream, client: 127.0.0.1, server: , request:
"GET /favicon.ico HTTP/1.1", upstream:
"fastcgi://unix:/Users/ME/.valet/valet.sock:", host: "test.dev",
referrer: "http://test.dev/"
Does the same when pointing to laravel install dirs.
I'm unfamiliar with nginx. What is the file it doesn't find exactly ?
And how to resolve this problem ?
EDIT: I don't have a valet.sock file, that might be the problem but I don't know what to put inside.
Try to run valet install again, it might have something wrong with the configuration.

Installing nginx, info.php, connect() failed to open php5-fpm.sock

Attempting to access:
mydomain.name/info.php
Error Log:
2016/01/01 18:23:00 [crit] 15592#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while
connecting to upstream, client: censoredipaddress1, server:
censoredipaddress2, request: "GET /info.php HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php5-fpm.sock:", host: "censoredipaddress3"
Censored addresses:
1: test home computer ip address
2: ipaddress to nginx VPS
3: domain name
NGinx (installed from source code with RTMP module added)
Customizations: basic_auth, RTMP
Ref. 1A: https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/
Linux EngineX MySQL PHP (on Ubuntu 15 x64)
Ref. 2A: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04
<<< MISC NOTES/COMMENTS >>>
I noticed that source builds of NGinx, the actual file path to html is /usr/local/nginx/html and folders called "websites_enabled" or the like do not exist (as far as I know).
When using (i did NOT use this to install nginx because it does not allow me to easily add RTMP, If I have to do it this way then please explain how to install RTMP this way)
apt-get install nginx
the websites_enabled file structure is present and so are the expected /usr/shared and /www directories.
I tried some other fixes which made me include some stuffs like www-data but I am not using www-data (i think that is used when my html file is found in www/)
I'm trying to add PHP to my RTMP streaming capabilities and since I am unable to install RTMP using apt-get install nginx I will need help installing RTMP if I am forced to use apt-get install nginx to be able to use php.
Thank You In Advance!

Raspbian owncloud nginx [error] 2667#0: *4 connect() failed (111: Connection refused) while connecting to upstream

I am using a Raspberry pi to host a owncloud server. It uses nginx, and when I configured the pi with this tutorial, the page came up with a 502 Bad Gateway error. I checked the logs and found this:
2015/10/22 05:18:03 [error] 2667#0: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.101, server: 192.168.1.102, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.102", referrer: "https://192.168.1.102/"
EDIT: Nevermind this question anymore, I have moved on to using a different platform. However, I am still urious as to what this problem is.
I tried to fix it with several other solutions found in posts on this site like here and here, as well as ensuring that php was installed, but none worked. I am stumped as I am a relative newbie to linux and know nothing about nginx. Any help is appreciated. Thanks in advance.
The php-fpm is not running. You should run the php-fpm.
If you has add the php-fpm as a service : service php-fpm restart
Or {PHP_PATH}/sbin/php-fpm {PHP_PATH} is the --with-prefix=/path/ when you ./configure the php

Categories