Report this

What is the reason for this report?

LEMP will not serve php

Posted on April 11, 2017

I can’t seem to get php working with nginx…

I’ve used the LEMP 1 click deploy and tried doing it on my own, and tried following countless tutorials out there.

Here is my config for this vhost

server {
  listen 80;
  server_name SERVER.COM;
    return 301 https://$host$request_uri;

    location /.well-known {
        alias /var/www/DIR/.well-known;
    }
}

server {
  listen 443;
  server_name SERVER.COM;
  ssl_certificate /etc/letsencrypt/live/SERVER.COM/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/SERVER.COM/privkey.pem;
  add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
  ssl on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;

  location / {
    root /var/www/SERVER.COM/;
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;

        }

        location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        location ~ /\.ht {
          deny all;
        }

        location /monit/ {
        rewrite ^/monit/(.*) /$1 break;
        proxy_ignore_client_abort on;
        proxy_pass   http://localhost:2812;
        }
}

All I am trying to do is to get a simple phpinfo to run. I see the request served in the access logs, nothing in the error logs

Relevant info

php/xenial,now 1:7.0+35ubuntu6 all [installed]
php-apcu/xenial,now 5.1.3+4.0.10-1build1 amd64 [installed]
php-common/xenial,now 1:35ubuntu6 all [installed,automatic]
php-curl/xenial,now 1:7.0+35ubuntu6 all [installed]
php-fpm/xenial,now 1:7.0+35ubuntu6 all [installed]
php-mcrypt/xenial,now 1:7.0+35ubuntu6 all [installed]
php-mysql/xenial,now 1:7.0+35ubuntu6 all [installed]
php7.0/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 all [installed,automatic]
php7.0-cli/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-common/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-curl/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-fpm/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-json/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-mcrypt/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-mysql/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-opcache/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
php7.0-readline/xenial-updates,xenial-security,now 7.0.15-0ubuntu0.16.04.4 amd64 [installed,automatic]
nginx/xenial-updates,xenial-security,now 1.10.0-0ubuntu0.16.04.4 all [installed]
nginx-common/xenial-updates,xenial-security,now 1.10.0-0ubuntu0.16.04.4 all [installed,automatic]
nginx-core/xenial-updates,xenial-security,now 1.10.0-0ubuntu0.16.04.4 amd64 [installed,automatic]

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.