0

我试图将我在本地主机上启动的 drupal 站点移动到家中的服务器。该数据库既从我的本地主机导出并存储在服务器上。

nginx.conf文件内容如下

events {
worker_connections 768;
    # multi_accept on;
}

http{ 
    server {
        listen 443 ssl;

         ########  S S L    CONFIGURATIONS ##################
        ssl_certificate /etc/ssl/Nov2021/STAR_site.edu.co.crt;
        ssl_certificate_key /etc/ssl/Nov2021/site.edu.co.key;
        access_log /var/log/nginx/KNH_nginx.vhost.access.log;
        error_log /var/log/nginx/KNH_nginx.vhost.error.log;



        root /var/www/html/arctic_kittiwake;
        index index.php index.html index.htm;

    ###################################################
   
        server_name site.edu.co

        location / {
            #try_files $uri $uri/ /index.php?q=$uri&$args;
            try_files $uri /index.php?q=$uri$args;
        }

        location /site/ {
           if (!-e $request_filename){
               rewrite ^/site/(.*)$ /site/index.php break;
           }
        }

        location ~ \.php$ {
            fastcgi_index index.php;
        }

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

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

        location ~ /\. {
            deny all;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
            deny all;
        }

    }
}

该文件存储的目录是/etc/nginx,drupal 站点存储在/var/www/html/arctic_kittiwake/目录中。

我还安装了 php7.4-fpm 和 mariadb-10.3。

4

1 回答 1

0

您缺少与 php-fpm 的连接。

例子:

    # 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)(|/.*)$;
        # 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.0-fpm.sock;
    }

完整示例在这里https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

于 2020-11-17T11:07:33.040 回答