WordPress in subdirectory nginx

Hi I have an Nginx Server with running wp’s with no problem. I just created a site in blank html5 and added some functions with php. Then my client decided to have a blog too. So i installed WordPress into a subdirectory. My only problem is the Nginx config which I cant figure it out. I have the site on example.com/ the wp is on example.com/wp/site/ But even when i have configured everything correctly My Admin panel does not works. So i share my code, and I would highly appreciate some help. I have found similar articles online, but they does not help at all. So please take a look at my Nginx cfg for this site, and tell me whats wrong. Thank you!

    server {
  server_name domain.com;
  listen 80;
  root /var/www/domain;
  include wordpress.conf;

 location / {
 index index.php index.html index.htm;
}

  # Block PHP files in uploads directory.
  location ~* /wp/acc/wp-content/uploads/.*.php$ {
    deny all;
  }
  location ~ ^/.user.ini {
    deny all;
  }
  location /wp/acc {
    limit_except GET POST OPTIONS HEAD { deny all; }
    try_files $uri $uri/ /wp/acc/index.php?$args;
  }
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
server {
  server_name domain.com;
  listen 81;
  root /var/www/domain;
 index index.php index.html index.htm;
  include wordpress7080.conf;

 location / {
index index.php index.html index.htm;
}

  # Block PHP files in uploads directory.
  location ~* /wp/acc/wp-content/uploads/.*.php$ {
    deny all;
  }
  location ~ ^/.user.ini {
    deny all;
  }
  location / {
    limit_except GET POST OPTIONS HEAD { deny all; }
    try_files $uri $uri/ /wp/acc/index.php?$args;
  }
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

Additional Info:

Read More

Wp-config.php has not been modified.
Url’s in database are correct.
Wordpress.conf only includes basic wordpress setup for nginx.

Related posts

1 comment

  1. you have to change the root statement to the directory of each wordpress in the server { } code block

    root /var/www/wp1;
    root /var/www/wp2;
    

    Also, you can check in your

    /var/log/nginx/error* 
    /var/log/nginx/access*
    

    to get more information on how things are working.

Comments are closed.