Is an app dir as subdirectory of an app dir possible?


I have on a shiny server a directory with an app:R, lets say /srv/shiny-server/examples . In this directory I have subdirectory which contains another app, e.g. /srv/shiny-server/examples/app/myapp . Whenver I try to access https://myshinyserver/examples/app/myapp then I get an error message, but the access to https://myshinyserver/examples works. When I move my app to /srv/shiny-server/app/myapp then the app works properly under https://myshinyserver/app/myapp . Is this a limitation of the shiny server?

Best Sigbert

No this is not a limitation of Shiny Server, but has to do with the order in which it resolves locations and this can be configured in the /etc/shiny-server.conf file. You can follow the instructions for locations in the Shiny Server Administrator's guide to set up two locations: one for your main application and one for the application(s) in a subdirectory. But the trick is to define the location for the subdirectory before the location of the main app. So in your case it would look something like:

run_as shiny

server {
  listen 3838;

  location /examples/app {
    # multiple applications in directory 'app',
    # e.g. '/srv/shiny-server/examples/app/myapp' or
    # '/srv/shiny-server/examples/app/anotherapp':
    site_dir /srv/shiny-server/examples/app/;

    log_dir /var/log/shiny-server;
    directory_index on;

  location /examples {
    # one application in directory 'myapp':
    app_dir /srv/shiny-server/examples/myapp;

    log_dir /var/log/shiny-server;

In this example, the configuration uses site_dir for the subdirectory such that you can host multiple applications there, but you could also use app_dir to host just a single application.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.