Detailed descriptions of all available parameters are available in the appendix, but it is important to understand the overall hierarchy of the Shiny Server configuration file when editing the file.
The server setting defines an HTTP server which will listen on a port/IP address combination. For example, the following lines:
server { listen 80; }
define a server that would listen on port 80. A server can also define a server_name to limit the virtual hostnames on which it listens, as described in the Virtual Hosts section.
The location setting is defined within a server and defines how a particular URL path should be served. For instance, the following settings:
server { ... # Define the location '/specialApp' location /specialApp { # Run this location in 'app_dir' mode, which will host a single Shiny # Application available at '/srv/shiny-server/myApp' app_dir /srv/shiny-server/myApp } # Define the location '/otherApps' location /otherApps { # Run this location in 'site_dir' mode, which hosts the entire directory # tree at '/srv/shiny-server/apps' site_dir /srv/shiny-server/apps; } ... }
would define two locations, one which serves (potentially) a multitude of applications at the URL /otherApps/, and another which serves a single application at the URL /specialApp/.
The various hosting models which can be applied to a location are described in the section on Hosting Models.
The application block is specified within a location and defines the settings related to a particular application. The application is referenced by the directory in which it is stored. For example, the following configuration could be used to modify the application housed at /srv/shiny-server/app1.
... location / { # Define rules to apply to one application, stored at '/srv/shiny-server/app1' application /srv/shiny-server/app1 { simple_scheduler; } } ...
This block would specify that, within this location, the referenced application should use the Simple Scheduler. This setting would have no effect on the other applications hosted in this location block.
There are currently four different methods of configuring a location, three of which serve Shiny applications. These three are described below; see the following section on Redirecting to learn about a fourth mode.
A location configured to use app_dir will attempt to serve a single application hosted at the given directory. For instance,
# Define the location '/specialApp' location /specialApp { app_dir /srv/shiny-server/myApp; }
will configure the location responsible for the path /specialApp to use this app_dir router which serves a single application stored in the directory /srv/shiny-server/myApp. This configuration would presume a server.R file (and corresponding ui.R file) would be available at /srv/shiny-server/myApp/server.R.
A location which uses site_dir will host an entire directory tree -- both Shiny Apps and static assets.
# Define the location '/' location / { site_dir /srv/shiny-server/ }
The above configuration would instruct Shiny Server to make the /srv/shiny-server/ directory available at the base URL. Any Shiny applications stored in this directory (or any subdirectory), along with any static assets (including images, data, JavaScript/CSS files, etc.) will be made available at the corresponding URL. For example, see the following directory tree:
+---/srv/shiny-server | +---shinyApp1 | +---server.R | +---ui.R | +---shinyApp2 | +---server.R | +---ui.R | +---assets | +---style.css | +---script.js
If this server were available at http://server.com, the location settings above would make the following (along with any other file in the tree) publicly available to the user.
Serve the Shiny App defined in 'shinyApp1' |
|
Serve the Shiny App defined in 'shinyApp2' |
|
Serve this static CSS file |
|
Serve this static JS file |
A location configured to use user_apps will allow users on the system to create and manage their own Shiny applications available in their home directories. This directive will host any application stored in an eligible user's ~/ShinyApps directory publicly at a URL prefaced by their username.
This privilege can be restricted only to users of particular groups using the members_of restriction. For instance, the following configuration:
# Define the location '/userApps' location /userApps { user_apps; # Only allow members of the 'shinyUsers' group to host personal applications. members_of shinyUsers; }
will -- for any user who is a member of the shinyUsers group -- publicly host any Shiny application available in the user's ~/ShinyApps directory.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I have an issue to host the directory under shiny sever.
In my shiny-server.conf, i put the following
server {
listen 3838;
location /model1 {
site_dir /data/model;
log_dir /var/log/shiny-server;
directory_index on;
}
}
The app is working, but i cannot access the files under the directory.
For example, the http://server:3838/model1 ( app link) works,
but i cannot access to any file under the site_dir, or any link as
http://server:3838/model1/test.pdf doesn't work.
Can you help me to solve this issue, or point to the right direction? Thanks.
Also,i notice that, even if i set the listen port to be 3838, everytime the shiny-server log file will show that the app is running at some random port number, e.g. 12345 not 3838.
Is this what shiny-server do, or i need to change some configuration file?
thanks
andy
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/8ab3b80e-8835-49d8-9eb9-18e0080fd384%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.