Nadelina
Nadelina

Reputation: 3

worspress nginx alias not working properly

I have the current configuration like this:

    #test blog
    location /test {
        alias /var/www/domain/test;

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

        location /test {
                try_files $uri $uri/ /index.php?$args;
        }

        location /test/wp-admin {
            try_files $uri $uri/ /wp-admin/index.php?$args;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include snippets/fastcgi-php.conf;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_pass v0y.cc-php-handler;
        }

        location /test/login {
          return 301 /test/wp-admin;
        }

        ## Hiding User.ini 
        location ~ \.user\.ini$ {
          deny all;
        }

     }

It works, my WordPress instance is accessible and configurable, I can access all links via plain settings but if I try another method of links like for example Day and name I get an 404 error by nginx.

ej plain link: https://domain/test/?p=123 ej Day and name: https://domain/test/2024/04/17/sample-post/

How do fix my config to be accessible via other methods of Permalink Settings?

I tried adding more location blocks but this methodology only works if you know the folder name in advance.

        location /test/wp-admin {
            try_files $uri $uri/ /wp-admin/index.php?$args;
        }

Upvotes: 0

Views: 37

Answers (0)

Related Questions