# Do not working nginx...

**URL:** <https://forum.ansible.com/t/do-not-working-nginx/25913>\
**Category:** Ansible Project\
**Created:** [November 3, 2017, 1:12pm UTC](https://forum.ansible.com/t/do-not-working-nginx/25913 "2017-11-03T13:12:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 3, 2017, 1:12pm UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/1 "2017-11-03T13:12:02Z")

</div>

Hi everyone

I’m trying to make a [film](https://youtu.be/Defm3i9jYvo)[project](https://github.com/Robocop01/php-joomla-vm)  
But the test site does not open (neither by ip nor PC). 502 Bad Gateway  
I think the problem is in the configuration settings of nginx or php-fpm.

Thanks

---

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 5, 2017, 8:02am UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/2 "2017-11-05T08:02:08Z")

</div>

It is my error.

/var/log/nginx/joomla\_error.log

`  
2017/11/04 22:18:14 [crit] 10876#10876: \*1 connect() to unix:/run/php/php7.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.5.1, server: joomla.devv, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock:”, host: “192.168.5.2”

`

How will decide that problem?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 5, 2017, 9:30am UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/3 "2017-11-05T09:30:52Z")

</div>

Hi

I see only an error, and nothing more.  
In order to help you we need to know what you are trying to achieve.  
The ansible playbook would be a good start.

DIck

---

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 5, 2017, 11:03am UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/4 "2017-11-05T11:03:49Z")

</div>

I want to run the Nginx server and PHP-FPM.  
But the web page does not open (502 Bad Gateway)  
I’ll find out that the pool (php7.1-fpm) is not running  
Ii is all my [project](https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FRobocop01%2Fphp-joomla-vm&sa=D&sntz=1&usg=AFQjCNHT3NfiyroD--V1e5v1TZyX_LUx5g)  
`

| 
- name: install php{{ php.version }}-fpm

 |
|
| |

| 

apt: name=php{{ php.version }}-fpm state=present

 |
|
| |

| |
|
| |

| 
- name: delete default config

 |
|
| |

| 

file: path=/etc/php/{{ php.version }}/fpm/pool.d/www.conf state=absent

 |
|
| |

| |
|
| |

| 
- name: render php fpm pools config

 |
|
| |

| 

template: src=pool-template.j2 dest=/etc/php/{{ php.version }}/fpm/pool.d/{{ item.name }}

 |
|
| |

| 

with\_items: ‘{{ apps }}’

 |
|
| |

notify: restart php-fpm `

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 6, 2017, 1:25pm UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/5 "2017-11-06T13:25:23Z")

</div>

You need to know \*why\* it isn't running.  
The playbook you sent has a huge amount of empty lines - there could  
be an issue there.  
In any case there is a notify: statement (not sure why that is  
rendered in italic, or why you need HTML to display plain text  
content).  
That notifies a handler.  
If php-fpm isn't running, it must have not been restarted - so  
something is off with the handler that does this.  
So, check that handler, your issue is likely there.

Dick

---

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 7, 2017, 8:07am UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/6 "2017-11-07T08:07:20Z")

</div>

php-joomla-vm/provisioning/roles/php-fpm/tasks/mail.yml

`

- name: install php{{ php.version }}-fpm  
apt: name=php{{ php.version }}-fpm update\_cache=yes state=present

- name: delete default config  
file: path=/etc/php/{{ php.version }}/fpm/pool.d/www.conf state=absent

- name: render php fpm pools config  
template: src=pool-template.j2 dest=/etc/php/{{ php.version }}/fpm/pool.d/{{ item.name }}  
with\_items: ‘{{ apps }}’  
notify: restart php-fpm  
`

php-joomla-vm/provisioning/roles/php-fpm/handlers/mail.yml

`

- name: restart php-fpm  
service: name=php{{ php.version }}-fpm state=restarted  
`

php-joomla-vm/provisioning/roles/php-fpm/templates/pool-template.j2

`  
[{{ item.name }}]

user = {{ item.user }}  
group = {{ item.group }}

listen = /run/php/php{{ php.version }}-fpm.sock

listen.owner = {{ item.user }}  
listen.group = {{ item.group }}

pm = dynamic

pm.max\_children = 5  
pm.start\_servers = 2  
pm.min\_spare\_servers = 1  
pm.max\_spare\_servers = 3  
`

vagrant provision

`  
Введите код.TASK [php-fpm : install php7.1-fpm] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [joomla] =\> {“cache\_update\_time”: 1510040072, “cache\_updated”: true, “changed”: false, “failed”: false}

TASK [php-fpm : delete default config] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [joomla] =\> {“changed”: false, “failed”: false, “path”: “/etc/php/7.1/fpm/pool.d/www.conf”, “state”: “absent”}

TASK [php-fpm : render php fpm pools config] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [joomla] =\> (item={u’domain’: u’joomla.devv’, u’group’: u’vagrant’, u’name’: u’joomla’, u’db\_user’: u’joomla’, u’db\_passwd’: u’secret’, u’db\_name’: u’joomla’, u’user’: u’vagrant’, u’type’: u’joomla’}) =\> {“changed”: false, “checksum”: “4237b94802ee910cefa41196b2cc8dbaa27bf9c4”, “failed”: false, “gid”: 0, “group”: “root”, “item”: {“db\_name”: “joomla”, “db\_passwd”: “secret”, “db\_user”: “joomla”, “domain”: “joomla.devv”, “group”: “vagrant”, “name”: “joomla”, “type”: “joomla”, “user”: “vagrant”}, “mode”: “0644”, “owner”: “root”, “path”: “/etc/php/7.1/fpm/pool.d/joomla”, “size”: 269, “state”: “file”, “uid”: 0}  
…  
`

What could be wrong with the handler?

---

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 8, 2017, 9:42pm UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/7 "2017-11-08T21:42:24Z")

</div>

In the directory “/run/ php/” there is no php7.1-fpm.sock  
How should he appear there?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 8, 2017, 10:01pm UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/8 "2017-11-08T22:01:28Z")

</div>

I think your best bet is to either check the logs to see why your  
php-fpm processes aren't creating sockets in that directory, or  
manually install things to see at what stage things go wrong.

---

<div class="post-metadata">

**Author:** ![Artur001](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Artur001](https://forum.ansible.com/u/Artur001)\
**Post date:** [November 10, 2017, 8:19am UTC](https://forum.ansible.com/t/do-not-working-nginx/25913/9 "2017-11-10T08:19:06Z")

</div>

php7.1-fpm.log is empty  
What other “log” to see?
