- OS Version
[141 shiny localhost 2014-09-30 10:22:43 /home/shiny]
cat /etc/redhat-release
CentOS release 6.5 (Final)
- Version of Shiny Server
[142 shiny localhost 2014-09-30 10:23:00 /home/shiny]
shiny-server --version
Shiny Server v1.2.2.366
Node.js v0.10.21
- Shiny apps work locally in R
All shiny apps (shown in directory tree below) work fine when run from the command line with runApp(), e.g.,
[144 shiny localhost 2014-09-30 10:24:40 /home/shiny]
cd /srv/shiny-server/01_hello
[145 shiny localhost 2014-09-30 10:24:54 /srv/shiny-server/01_hello]
R
R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
. . .
> library(shiny)
> runApp()
Listening on http://127.0.0.1:7271
- Apache server works fine
Firefox browser shows:
- "Apache 2 Test Page" at http://localhost
- "Welcome to Shiny Server" at http://localhost/shiny/
- Modifications to /etc/httpd/conf/http.conf
[148 shiny localhost 2014-09-30 10:28:52 /home/shiny]
tail -12 /etc/httpd/conf/httpd.conf
#<VirtualHost *:80>
# ProxyPass / http://localhost:3838/
# ProxyPassReverse / http://localhost:3838/
# #ProxyPreservation On
Alias /shiny /srv/shiny-server
<Directory /srv/shiny-server>
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
#</VirtualHost>
The "VirtualHost" didn't seem to work above, but the Alias did.
- Copy of /etc/shiny-server/shiny-server.conf file
[149 shiny localhost 2014-09-30 10:29:04 /home/shiny]
cat /etc/shiny-server/shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 3838
server {
listen 3838;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
- Copy of /etc/init/shiny-server.conf
[211 shiny localhost 2014-09-30 15:39:06 /home/shiny]
cat /etc/init/shiny-server.conf
# shiny-server.conf
description "Shiny application server"
export R=/usr/bin/R
start on runlevel [2345]
stop on runlevel [016]
limit nofile 1000000 1000000
post-stop exec sleep 5
exec shiny-server --pidfile=/var/run/shiny-server.pid >> /var/log/shiny-server.log 2>&1
# This does not work to set shiny user at startup:
#exec su -s /bin/sh -c 'exec "$0" "$@"' shiny -- shiny-server --pidfile=/var/run/shiny-server.pid >> /var/log/shiny-server.log 2>&1
respawn limit 3 25
respawn
- The directory structure of where you have your applications
[150 shiny localhost 2014-09-30 10:30:01 /home/shiny]
tree /srv/shiny-server
/srv/shiny-server
├── 01_hello
│ ├── DESCRIPTION
│ ├── Readme.md
│ ├── server.R
│ └── ui.R
. . .
├── 11_timer
│ ├── DESCRIPTION
│ ├── Readme.md
│ ├── server.R
│ └── ui.R
├── index.html -> /opt/shiny-server/samples/welcome.html
└── sample-apps -> /opt/shiny-server/samples/sample-apps
13 directories, 45 files
- The URL you are using to access your application(s)
http://localhost/shiny/ [shows "Welcome to Shiny Server" page but only shows Index of /shiny/sample-apps/hello and Index of /shiny/sample-apps/rmd instead of apps. Both apps should appear since rmarkdown is installed.]
http://localhost/shiny/index.html [same as above]
http://localhost/shiny/02_text/ [shows Index of /shiny/02_text]
If httpd service is stopped, Firefox shows the message "Unable to connect". After httpd is started, the display changes to "index of …"
- Also, if you see any errors in the /var/log/shiny-server.log file
After reboot
[211 shiny localhost 2014-09-30 15:30:19 /home/shiny]
cat /var/log/shiny-server.log
[2014-09-30 15:28:16.619] [INFO] shiny-server - Shiny Server v1.2.2.366 (Node.js v0.10.21)
[2014-09-30 15:28:16.621] [INFO] shiny-server - Using pidfile /var/run/shiny-server.pid
[2014-09-30 15:28:16.622] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2014-09-30 15:28:16.737] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2014-09-30 15:28:16.746] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[211 shiny localhost 2014-09-30 15:32:58 /home/shiny]
su root
Password:
[root@localhost shiny]# stop shiny-server
shiny-server stop/waiting
[root@localhost shiny]# exit
exit
[211 shiny localhost 2014-09-30 15:33:55 /home/shiny]
/opt/shiny-server/bin/shiny-server
[2014-09-30 15:34:24.350] [INFO] shiny-server - Shiny Server v1.2.2.366 (Node.js v0.10.21)
[2014-09-30 15:34:24.353] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2014-09-30 15:34:24.415] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2014-09-30 15:33:09.620] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2014-09-30 15:33:09.622] [INFO] shiny-server - Shutting down worker processes (with notification)
No change in output
http://localhost/shiny/ [shows "Welcome to Shiny Server" page but only shows Index of /shiny/sample-apps/hello and Index of /shiny/sample-apps/rmd instead of apps. Both apps should appear since rmarkdown is installed.]
http://localhost/shiny/02_text/ [shows Index of /shiny/02_text]
What else should I check to figure out why I only see "Index of" for shiny apps?
Thanks for any help.
#<VirtualHost *:80>
# ProxyPass / http://localhost:3838/
# ProxyPassReverse / http://localhost:3838/
# #ProxyPreservation On
#<VirtualHost *:80>
# ProxyPass / http://localhost:3838/
# ProxyPassReverse / http://localhost:3838/
# #ProxyPreservation On
...<p class="MsoNormal" style="margin:0in 0in 0pt 0.5in;line
I uncommented the lines in the Apache file (/etc/httpd/conf/httpd.conf) except for the “ProxyPreservation On” line, restarted Apache, and tried viewing http://localhost in Firefox. I saw the message “Service Temporarily Unavailable”, which I also saw yesterday when I first tried this.
I tried http://localhost:3838 and the index.html, which is linked to the welcome.html, does display, along with the two working shiny apps on that page!! http://localhost:3838/index.html also works. So that is very good progress.
Finally, I tried a variation of your suggestion and it works to show the 2nd app: http://localhost:3838/02_text. I’ll try some of the other apps tomorrow.
I don’t remember where I got the line “ProxyPreservation On”. Should that be “ProxyPreserveHost On”? That doesn’t give an error, but I still need to enter all the 3838 port numbers. Am I missing something that would eliminate the need for all the port numbers?
Thanks much.