Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

realtebo's avatar

App works served by `php artisan serve` but not using`nginx`

I created a new app using composer. I need 5.4 specifically for a test I need to do.

composer create-project --prefer-dist laravel/laravel blog "5.4.*" 

I can run app using

php artisan serve

But when triyng to serve it using nginx, I got the damn classic old blank white page.

Note: To simplify my life, because it's only a local dev virtual machine everything is owned by root:root and with permissions 777. So no permission problems.

ENV: I am working on a Ubuntu 16.04.5 vmware virtual machine, with 4 cpu + 4 gb ram and a lot of free space.

My /var/log/nginx/*.log files do not present me any kind of error.

Please, could you check my nginx config file?

server {

    listen       80;

    server_name  demo_app.ismyservice.space;
    
    root         /var/www/html/demo_app/public;

    add_header  X-Frame-Options "SAMEORIGIN";
    add_header  X-XSS-Protection "1; mode=block";
    add_header  X-Content-Type-Options "nosniff";

    charset     utf-8;

    index       index.php index.html index.htm;
    
    location / {
        try_files   $uri $uri/ /index.php?$query_string;
    }

    location    = /favicon.ico { access_log off; log_not_found off; }
    location    = /robots.txt  { access_log off; log_not_found off; }

    error_page  404 /index.php;

    location ~ \.php$ {
        fastcgi_pass    unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index   index.php;
        include         fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

}

I already checked /var/run/php/php7.2-fpm.sock

stat /var/run/php/php7.2-fpm.sock
  File: '/var/run/php/php7.2-fpm.sock'
  Size: 0               Blocks: 0          IO Block: 4096   socket
Device: 13h/19d Inode: 232         Links: 1
Access: (0660/srw-rw----)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2019-01-13 17:00:29.014876613 +0100
Modify: 2019-01-13 16:47:33.710778131 +0100
Change: 2019-01-13 16:47:33.710778131 +0100
 Birth: -

Also, I am not able to view via browser any simple php file. Something is wrong in the way I ask nginx to comunicate to php OR what?

Kindly, I am here asking an help to diagnose se problem!

0 likes
0 replies

Please or to participate in this conversation.