首页 > 解决方案 > Nginx 正在运行,但页面为空白

问题描述

我正在尝试在 DigitalOcean 中托管的 Ubuntu 服务器上配置 MunkiReport ( https://github.com/munkireport/munkireport-php ) 站点。我已经安装和配置了 PHP 和 MySQL。当我导航到我的 webroot 时,我从 nginx 收到一条成功的消息。

我的 webroot 是/usr/share/nginx/html,我将/usr/local其用作 Munki 和 MunkiReport 的存储库。/usr/local/report/public我将文件夹的符号链接放入/usr/share/nginx/html.

这是我的 nginx 配置(/etc/nginx/sites-enabled/default)文件:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    server_name example.com;

    location /report {
        alias /usr/share/nginx/html/public;
        autoindex off;
        location ~ \.php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
          fastcgi_index index.php;
          include fastcgi_params;
        }
    }

    location /munki_repo/ {
      alias /usr/local/munki_repo/;
      autoindex off;
      auth_basic "Restricted";
      auth_basic_user_file /etc/nginx/.htpasswd;
  }

    listen [::]:443 ssl ipv6only=on;
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
 if ($host = example.com) {
    return 301 https://$host$request_uri;
  }
}

我的.envMunkiReport 文件夹的根目录中有一个文件,其中包含配置信息(MySQL 数据库连接)。

当我导航到该https://example.com/report位置时,没有加载任何内容。控制台也没有显示任何错误,它只是空白。

标签: phpubuntunginxdigital-ocean

解决方案


推荐阅读