# NGINX and php-fpm -\> HTML runs, php gives 502

**URL:** <https://www.ruby-forum.com/t/nginx-and-php-fpm-html-runs-php-gives-502/237085>\
**Category:** NGINX\
**Created:** [October 23, 2013, 4:13pm UTC](https://www.ruby-forum.com/t/nginx-and-php-fpm-html-runs-php-gives-502/237085 "2013-10-23T16:13:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 23, 2013, 4:13pm UTC](https://www.ruby-forum.com/t/nginx-and-php-fpm-html-runs-php-gives-502/237085/1 "2013-10-23T16:13:51Z")

</div>

hi,  
apparently have some problems with it so I am not better .  
Unfortunately, past attempts have brought nothing to use the information  
from other posts .  
And so , I really hope that this one can help ^ ^

So, I have NGINX installed and php - fpm .

I call on the index.html , everything works .  
I call on the index.php , I get back only n 502.

For various reasons which I will not name here on, is not the www  
directory  
www in / var / www but in /  
then there are a host folder.  
so :

/ www / devubuntu.loc  
/ www / devubuntu.loc / index.html  
/ www / devubuntu.loc / index\_test.php

My default conf looks like this:

```auto
server {
listen 80;
server_name devubuntu.loc;

access_log /www/log/access/devubuntu.loc.access.log;
error_log /www/log/error/devubuntu.loc.error.log;

location / {
root /www/devubuntu.loc;
index index.html index.htm, index.php;
}

location ~ \.php$ {

root /www/devubuntu.loc;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php **5** -fpm.sock;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```

Does anyone here have an idea ?  
Timo

Posted at Nginx Forum:

> **[NGINX and php-fpm -\> HTML runs, php gives 502](https://forum.nginx.org/read.php?2,244039,244039#msg-244039)**
>
> hi, apparently have some problems with it so I am not better . Unfortunately, past attempts have brought nothing to use the information from other posts . And so , I really hope that this one can help ^ ^ So, I have NGINX installed and php - fpm . I

---

<div class="post-metadata">

**Author:** ![timofrenzel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ac8455/32.png) [@timofrenzel](https://www.ruby-forum.com/u/timofrenzel)\
**Post date:** [October 23, 2013, 4:39pm UTC](https://www.ruby-forum.com/t/nginx-and-php-fpm-html-runs-php-gives-502/237085/2 "2013-10-23T16:39:00Z")

</div>

On Wed, Oct 23, 2013 at 10:13:36AM -0400, timofrenzel wrote:

Hi there,

> I call on the index.html , everything works .  
> I call on the index.php , I get back only n 502.

When you do

curl -i [http://devubuntu.loc/index.php](http://devubuntu.loc/index.php)

what response do you get, and what do the nginx log files say happened?

Copy-paste is best.

> fastcgi\_pass unix:/var/run/php5-fpm.sock;

Is there a fastcgi server listening on that socket? What does its log  
files say happened?

## f

Francis D. removed\_email\_address@domain.invalid
