I am running a setup on Ubuntu and WSL (Windows Subsystem for Linux) with Nginx and PHP7.4.

Drupal 8 and Drupal 9 fresh installations load every page with no problem, except the page on /admin/modules.

On the error.log file I found this error.

2020/06/04 17:28:17 [error] 3610#3610: 1 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: d9.local, request: "GET /admin/modules HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "d9.local:8080", referrer: "http://d9.local:8080/"

The Nginx configuration is the following.

server {
    server_name d9.local;
    root /var/www/d9.local/web; ## <-- Your only path $
    access_log /var/www/d9.local/logs/access.log;
    error_log /var/www/d9.local/logs/error.log;

    listen 8080;
    listen [::]:8080;


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

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Very rarely should these ever be accessed outside of your lan
    location ~* \.(txt|log)$ {
        allow 192.168.0.0/16;
        deny all;
    }

    location ~ \..*/.*\.php$ {
        return 403;
    }

    location ~ ^/sites/.*/private/ {
        return 403;
    }

    # Block access to "hidden" files and directories whose names begin with a
    # period. This includes directories used by version control systems such
    # as Subversion or Git to store control files.
    location ~ (^|/)\. {
        return 403;
    }

    location / {
        # try_files $uri @rewrite; # For Drupal <= 6
        try_files $uri /index.php?$query_string; # For Drupal >= 7
    }

    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }

    # In Drupal 8, we must also match new paths where the '.php' appears in the middle,
    # such as update.php/selection. The rule we use is strict, and only allows this pattern
    # with the update.php front controller.  This allows legacy path aliases in the form of
    # blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have
    # any paths like that, then you might prefer to use a laxer rule, such as:
    #   location ~ \.php(/|$) {
    # The laxer rule will continue to work if Drupal uses this new URL pattern with front
    # controllers other than update.php in a future release.
    location ~ '\.php$|^/update.php' {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        include snippets/fastcgi-php.conf;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                fastcgi_read_timeout 60;
                fastcgi_keep_conn on;
                fastcgi_buffering off;
    }

    # Fighting with Styles? This little gem is amazing.
    # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
    location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7
        try_files $uri @rewrite;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

Drupal 7 fresh install loads the modules page fine.

Note that page loads if you switch from Nginx to Apache. Do I cross post this to Server Fault? I just don't see it how this can be Nginx fault for not loading one specific page and people at Server Fault might not just get it or work with Drupal, I don't know what other kind of information to provide.

While the page loads, running service php-fpm7.4 restart immediately loads the complete page. I had this issue previously on all pages, which was solved reading the answer for Pages load only when you restart php-fpm, more with .gif images and previews. I am still stuck on the Modules page.

有帮助吗?

解决方案

Problem was WSL1, in PowerShell with admin rights wsl -v -l

  NAME            STATE           VERSION
* Ubuntu-18.04    Running         1

Convert your WSL1 installation to WSL2 wsl --set-version Ubuntu-18.04 2

Takes about 10 minutes to finish and needs more than 10GB of free space on the drive for the process.

More at https://scotch.io/bar-talk/trying-the-new-wsl-2-its-fast-windows-subsystem-for-linux

许可以下: CC-BY-SA归因
scroll top