title: How to configure Nginx with php-fpm?
body: <p>Conclusion : Ok so, now my configuration works, and I think the problem comes from the location of my project, in another user's directory. For some reasons, the either nginx or php-fpm is unhappy with it, and doesn't seem to work.</p>
  
  <p>What's still bugging me is that it was a 404 error, not a 403.</p>
  
  <p>Well, I don't think I will find the final answer.</p>
  
  <p>I have read zillions of ways to do that, and unfortunately I don't understand what could go wrong.</p>
  
  <pre><code>server {
      server_name  onepage.cendrounet.com;
      listen       80;
      root /home/pag/workspace/test_css_platform;
  
      location / {
          fastcgi_pass unix:/var/run/php-fpm/www.sock;
          fastcgi_index index.php;
          include fastcgi.conf;
      }
  
      error_page 404 /404.html;
          location = /40x.html {
      }
  
      error_page 500 502 503 504 /50x.html;
          location = /50x.html {
      }
  }
  </code></pre>
  
  <p>Nginx is running.</p>
  
  <pre><code># systemctl status nginx
  ● nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
     Drop-In: /usr/lib/systemd/system/nginx.service.d
              └─php-fpm.conf
     Active: active (running) since Fri 2017-12-22 09:48:06 CET; 10h ago
  </code></pre>
  
  <p>Php-fpm is running :</p>
  
  <pre><code># systemctl status php-fpm
  ● php-fpm.service - The PHP FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2017-12-22 09:40:29 CET; 10h ago
  </code></pre>
  
  <p>Php-fpm is indeed an unix socket</p>
  
  <pre><code># ls -l /var/run/php-fpm/www.sock
  srw-rw----+ 1 root root 0 déc.  22 09:40 /var/run/php-fpm/www.sock
  </code></pre>
  
  <p>I am running fedora, but <code>ausearch -m avc</code> doesn't yield anything. (In case I don't understand how selinux works, <code>setenforce 0</code> hasn't yielded any better resutls. But still, I returned it on.)</p>
  
  <p>Furthermore, <code>curl -i 'http://onepage.cendrounet.com'</code> returns </p>
  
  <pre><code>HTTP/1.1 404 Not Found
  Server: nginx/1.12.1
  Date: Fri, 22 Dec 2017 19:11:49 GMT
  Content-Type: text/html; charset=UTF-8
  Transfer-Encoding: chunked
  Connection: keep-alive
  X-Powered-By: PHP/7.1.12
  </code></pre>
  
  <p>Furthermore, my user <code>nginx</code> belongs to my group <code>pag</code>.</p>
  
  <p>I have set my permissions like so :</p>
  
  <pre><code># namei -om /home/pag/workspace/css_test_platform/index.php
  f: /home/pag/workspace/css_test_platform/index.php
   dr-xr-xr-x root root /
   drwxr-xr-x root root home
   drwxr-x--x pag  pag  pag
   drwxr-xr-x pag  pag  workspace
   drwxrwxr-x pag  pag  css_test_platform
   -rw-rw-r-- pag  pag  index.php
  </code></pre>
  
  <p>The configuration of php-fpm is the default one, some details picked :</p>
  
  <pre><code>user = apache
  group = apache
  listen = /run/php-fpm/www.sock
  listen.acl_users = apache,nginx
  listen.allowed_clients = 127.0.0.1
  </code></pre>
  
  <p>Theorically, <code>user</code> and <code>group</code> should be for RPM stuff, but I still have given the <code>pag</code> group to <code>apache</code>.</p>
  
  <p>What could cause a <code>404</code> error on my index ?</p>