0

I'm running tomcat on main website using nginx proxy pass, now I want to install wordpress on the same domain as a sub-directory like this: example.com/blog

I used below config in nginx.

location /blog {

   root       /home/blog/html;
   index index.php index.htm index.html;
   try_files $uri $uri/ /blog/index.php?$args;


   }
  location ~ \.php$ {
        root     /home/blog/html;
        try_files $uri =404;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_read_timeout 200;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/blog-php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
   location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log off;
        log_not_found off;
        expires 30d;
    }

When I visit example.com/blog the WordPress installation page will go like this

http://example.com/wp-admin/setup-config.php

How can I properly install wordpress with Tomcat?

1 Answer 1

0

You need to tell wordpress that it lives in a subdirectory. I use wp-config.php rather than the dashboard, and I don't include the scheme or domain name:

define( 'WP_SITEURL', '/blog' );
define( 'WP_HOME', '/blog' );

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .