Shiny-server with a proxy Not Working after wordpress multisite added as subdirectory

278 views Asked by At

I have been using the wordpress, shiny-server and RStudio-server on Nginx + Ubuntu 14.04.

Wordpress was installed on a root. Shiny-server was installed per default procedures.

I added the following codes to /etc/nginx/sites-available/my_site_addresscom.conf to run shiny-server on my_site_address.com/shiny/.

 location /shiny/ {
  proxy_pass http://my_site_address.com:3838/;
 }

At this point, wordpress and shiny-server worked fine.

After that, I decided to add the new wordpress in subdirectory, following the procedures on this site. Installed Nginx helper plugin, and added the following codes to /etc/nginx/sites-available/my_site_addresscom.conf.

map $http_host $blogid {
    default 0;
    include /var/www/html/wp-content/uploads/nginx-helper/map.conf;
}

and

location ~ ^/files/(.*)$ {
  try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
  access_log off; log_not_found off; expires max;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 24h;
        log_not_found off;
}

location ^~ /blogs.dir {
        internal;
        alias /var/www/html/wp-content/blogs.dir ;
        access_log off; log_not_found off;      expires max;
}


if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
        rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}

After that, I cannot access to shiny-server with my_site_address.com/shiny/ while I can access with my_site_address.com:3838/.

Could you please advise me what is wrong? Thanks in advance!

1

There are 1 answers

1
RyRuss On

Self-solved.

It seems that

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { ...

section conflicts with

location /shiny/ { ...

section.

The problem has been solved with modifying '/shiny/' section as follows:

location ^~ /shiny/ { proxy_pass my_site_address.com:3838; }

Thanks and hope this helps somebody.