nginx showing blank PHP pages

前端 未结 17 2212
走了就别回头了
走了就别回头了 2020-12-04 05:56

I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on disp

17条回答
  •  萌比男神i
    2020-12-04 06:22

    This is my vhost for UBUNTU 18.04+apache+php7.2

    server {
        listen 80;
        server_name test.test;
        root /var/www/html/{DIR_NAME}/public;
        location / {
            try_files $uri /index.php?$args;
        }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }
    

    The last line makes it different than the other answers.

提交回复
热议问题