所有 Drupal 管理页面返回状态 404

问题描述 投票:0回答:1

作为前言,我正在尝试在 Lightsail 实例上设置 Drupal9 来管理我的产品组合。我已经安装了它并且可以加载 Drupal 主页。我现在遇到的问题是,当我导航到

https://example.com
(主页),然后尝试进入像
https://example.com/admin/content
这样的管理选项卡时,Nginx 返回状态 404。这是有道理的,因为没有位置块来处理目录,但我不确定下一步将如何服务这些页面。

现在,我已经将 Drupal 管理页面设置为使用我的基本 URL 和我的服务器根目录

/home/ubuntu/portfolio/projects/drupal
提供服务,但是
/home/ubuntu/portfolio/projects/drupal/admin/content
(这是 Nginx 尝试提供服务
http://example.com/admin/content
的位置)甚至不是Drupal 安装中的有效文件路径。所以我不确定这将如何正确地提供我需要的页面。

所以我的问题如下-

  1. 用于服务这些管理页面的文件位于相对于我的 Drupal 安装目录的位置?

  2. 我应该对 Nginx 中的以下 .conf 文件进行哪些更改才能正确服务它们,而不干扰其他位置块(或至少不破坏它们)。

     server{
         listen 80 default_server;
         listen [::]:80 default_server;
         server_name example.com;
         return 301 https://$server_name$request_uri;
     }
     server {
    
         listen 443 ssl;
         listen [::]:443;
    
         server_name example.com;
    
         ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
         ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    
         root /home/ubuntu/portfolio/projects/drupal;  #show users the resume by default
    
         index index.php;
    
    
         # Other config you desire (TLS, logging, etc)...
         location /resume {
             return 302 /resume/;
    
         location /resume/ {
             root /home/ubuntu/portfolio;
             index index.html;
         }
         location /weatherapp {
             return 302 /weatherapp/;
         }
         location /weatherapp/ {
             root /home/ubuntu/portfolio;
             index index.html;
         }
         location /cryptoDesign {
             return 302 /cryptoDesign/;
         }
         location /cryptoDesign/ {
             root /home/ubuntu/portfolio;
             index index.html;
         }  
         location ~ '\.php$|^/update.php' {
             #return 301 https://google.com;
             fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
             # Ensure the php file exists. Mitigates CVE-2019-11043
             try_files $fastcgi_script_name =404;
             # Security note: If you're running a version of PHP older than the
             # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
             # See http://serverfault.com/q/627903/94922 for details.
             include fastcgi_params;
             # Block httpoxy attacks. See https://httpoxy.org/.
             fastcgi_param HTTP_PROXY "";
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             fastcgi_param PATH_INFO $fastcgi_path_info;
             fastcgi_param QUERY_STRING $query_string;
             fastcgi_intercept_errors on;
             # PHP 5 socket location.
             #fastcgi_pass unix:/var/run/php5-fpm.sock;
             # PHP 7 socket location.
             fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
    
    
    }
    
php nginx drupal
1个回答
0
投票

这个问题现在有答案了吗?除了链接 nginx 文档之外? (这没有帮助)

虽然问题是 nginx 配置,但 nginx 不知道你应该如何为 Drupal 配置它,这是 Drupal 的工作。

解决办法是什么?您要在位置块中添加什么才能使其正常工作?文件夹 /admin/ 甚至不存在。 Drupal 需要弄清楚如何设置 apache 和 nginx,这样就不会造成混乱。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.