-2

I have my Drupal installation in the subdirectory with the following config file

server {
    listen 80;
    server_name example.com

    root /var/www/example;

    access_log /var/log/nginx/example_access.log;
    error_log /var/log/nginx/example_error.log;

    location ~* \.(txt|log)$ {
        allow 192.168.0.0/16;
        deny all;
    }
    location ~ ^/sites/.*/private/ {
        return 403;
    }
    location ~ ^/sites/[^/]+/files/.*\.php$ {
        deny all;
    }
    location ~* ^/.well-known/ {
        allow all;
    }
    location ~ (^|/)\. {
        return 403;
    }
    location /manage/d7/ {
        index index.php
        try_files $uri /index.php$query_string;
    }
    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }
    location ~ /vendor/.*\.php$ {
        deny all;
        return 404;
    }
    location ~ '\.php$|^/update.php' {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        include fastcgi_params;
        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;
       fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }
    location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
        try_files $uri @rewrite;
    }
    location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
        try_files $uri /index.php?$query_string;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        try_files $uri @rewrite;
        expires max;
        log_not_found off;
    }
}

Clear url does not work with the above configuration and i am unable to figure out what is causing the issue. Clean urls work with the same configuration if the Drupal install was in the root directory but when moved to the subdirectory, clean urls do not work, please help me figure out the issue.

0

1 Answer 1

0

Found the solution. Need to specify the Location to the subdirectory. Changing the following confix fixed the issue

location /manage/d7/ {
    try_files $uri /manage/d7/index.php$query_string;
}

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.