Issues configuring Shiny on my webserver

537 views
Skip to first unread message

Eilidh Hyslop

unread,
Jul 8, 2014, 10:32:52 AM7/8/14
to shiny-...@googlegroups.com
I am trying to configure Shiny on my webserver (Apache 2.4, Ubuntu 14.04) however it seems not to be configured properly. 

When I go to the /shiny/ directory (/srv/shiny/ which I am pointing to using an Alias in Apache), it displays the index.html 'Welcome to Shiny Server!' page. However, in the panel to the right, it does not display the hello sample app, but instead shows 'Index of /shiny/sample-apps/hello' 

I looked at this answer on Stack Overflow and tried sudo'ing over to the shiny user account and going into R and running library(shiny) and it seemed to work correctly (no errors occured, anyway) 

Any idea why this might be occuring? 

I did look at the Admin guide as suggested but I am afraid I am none the wiser. 

Thanks. 



Fereshteh Karimeddini

unread,
Jul 8, 2014, 10:53:12 AM7/8/14
to shiny-...@googlegroups.com
Eilidh,

Can you please provide the following info:

- Version of Shiny Server (shiny-server --version)
- Content of your /etc/shiny-server/shiny-server.conf file
- The URL you are using to access shiny application


Fereshteh

Eilidh Hyslop

unread,
Jul 8, 2014, 11:05:46 AM7/8/14
to shiny-...@googlegroups.com

  • The Version is Shiny Server v1.2.0.359 
  • The url I am using to access shiny is http://internalserver/shiny/ which is alias'ed to /srv/shiny-server/ on the server. 
  • The contents of my config file are attached

Fereshteh Karimeddini

unread,
Jul 8, 2014, 12:18:32 PM7/8/14
to shiny-...@googlegroups.com
Eilidh,

I just setup an Apache configuration that is working with Shiny Server. There might be other ways to handle this, but I am not very familiar with Apache. See if this option works for you.

- Edit Apache default configuration and setup a proxy that points to port 3838 (this is the port that Shiny Server is listening on)

sudo vi /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        ProxyPass / http://localhost:3838/
        ProxyPassReverse / http://localhost:3838/
        ProxyPreserveHost On


        Alias /shiny/ "/srv/shiny-server/"
        <Directory "/srv/shiny-server/">
               Options Indexes FollowSymLinks Includes ExecCGI
               Order allow,deny
               Allow from all
       </Directory>

- Restart Apache:

sudo /etc/init.d/apache2 restart

- With this setting, I can access the Shiny Server landing page as http://<hostname>
- I have other applications under /srv/shiny-server. For example: /srv/shiny-server/01_hello
I can access those as http://<hostname>/01_hello or such.

You can change the configuration to the way you want to handle the URLs.

Let me know how it goes, and if you still have problem with this.

Fereshteh

Fereshteh Karimeddini

unread,
Jul 8, 2014, 12:23:05 PM7/8/14
to shiny-...@googlegroups.com
Forgot to mention that you might need to enable some of Apache modules if they are not enabled already:

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html


Fereshteh

Jan Stanstrup

unread,
Jul 9, 2014, 3:41:30 AM7/9/14
to shiny-...@googlegroups.com
Thank you for this config. It works. But do you know a way to make shiny accessable at host.com/shiny instead of host.com so that apache can serve other things in the root? If I change to
ProxyPass /shiny/ http://localhost:3838/
ProxyPassReverse /shiny/ http://localhost:3838/

shiny shows up but renderUI/uiOutputs are not displayed. I asked before here but got no reply: https://groups.google.com/d/msg/shiny-discuss/JUzPpRmkHsA/Fx0eR1ogYWkJ


Jan.

Eilidh Hyslop

unread,
Jul 9, 2014, 4:33:52 AM7/9/14
to shiny-...@googlegroups.com
Thank you very much for your help. I will try that straight away. However, there are many other things hosted on the internal server. If http://internalserver/ will direct straight to Shiny, this will not be a workable solution for me as our internal website is at that address. 

Thanks! I will try that all now. 

Eilidh Hyslop

unread,
Jul 9, 2014, 5:09:11 AM7/9/14
to shiny-...@googlegroups.com
Okay, I tried all this (after making sure the Apache modules below were all enabled). Well, sort of. I'll get to that in a second. 

So, the internal website is hosted at http://internalserver/ , so I didn't want to bring this down inadvertently. In /etc/apache2/sites-available/default.conf there are some other <Directory>s specified, such as for that one, so I didn't want to remove that info too. 

Here is what my file looks like - 

<VirtualHost *:80> 
    ServerName internalserver
    ServerAdmin m...@corporate.com

    DocumentRoot /home/DATA/apache
    <Directory /home/DATA/apache/> 
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order deny,allow
        Deny from someaddress.corporate.com
    </Directory> 

    #Alias /shiny "/srv/shiny-server" 
    #<Directory "/srv/shiny-server>" 
    #    Options Indexes Multiviews FollowSymLinks
    #    AllowOverride All
    #    Require all granted
    #</Directory> 

</VirtualHost> 

<VirtualHost *:80>
    ServerAdmin m...@corporate.com 
    
    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> 

As you can see, I commented out the original entry for shiny and placed it below. Now, I'm pretty sure this is incorrect! But I wanted to try it out and see rather than do nothing - I was worried about doing precisely as you said because I didn't want to bring the internal site down. Any advice? 

(After doing this http://internalserver/shiny went down completely and I get a "403 Forbidden You do not have permission to access /shiny/ on this server" error) 

Thanks! 

Fereshteh Karimeddini

unread,
Jul 9, 2014, 4:17:09 PM7/9/14
to shiny-...@googlegroups.com
Eilidh,

About the configuration that I suggested, that was just a basic setup to show how you can setup a proxy to listen on port 3838.

The configuration that you need to serve applications at http://internalserver/shiny requires a change like this in your Apache configuration:
(Again, I am not an Apache expert, and you have to consider your server's current setup with any changes you want to make.)

        ProxyPass /shiny/ http://localhost:3838/

        ProxyPassReverse /shiny/ http://localhost:3838/shiny http://localhost:3838/
        ProxyPreserveHost On
        RedirectMatch permanent ^/shiny$ /shiny/

However, we realized (As Jan has also mentioned in an earlier post) that this configuration is not working with the latest version of Shiny Server (v1.2.0.359). We are looking into the issue, and possible workaround for it.

Thanks,
Fereshteh

Eilidh Hyslop

unread,
Jul 10, 2014, 11:02:36 AM7/10/14
to shiny-...@googlegroups.com
Thank you again for your help! 

I'm not sure what the issue is now, but if I go to http://internalserver/shiny/ the page displays as before, but with a different error - 'Not Found The requested URL /sample-apps/hello/ was not found on this server.' - in the panel. 

However... If you visit http://internalserver/shiny/sample-apps/hello/ the app runs correctly! 

So there must be an issue with how it is proxied etc. - I'll look into it with Apache type people. It must be the way the links are written in shiny's index.html page. 

Thank you kindly :) 

Eilidh Hyslop

unread,
Jul 10, 2014, 11:05:51 AM7/10/14
to shiny-...@googlegroups.com
Actually... It shows the slider but no plot... 

I have no idea why. 

Fereshteh Karimeddini

unread,
Jul 10, 2014, 11:14:00 AM7/10/14
to shiny-...@googlegroups.com
This is the issue that I was referring to. If you check your /var/log/shiny-server.log file, you should see a 404 error.
We are actively looking into fixing this problem.

Eilidh Hyslop

unread,
Jul 10, 2014, 11:29:16 AM7/10/14
to shiny-...@googlegroups.com
Okedoke, thank you! I really appreciate the help. 

Would you mind updating here if / when a fix is available? 

Cheers! 

Fereshteh Karimeddini

unread,
Jul 10, 2014, 12:17:50 PM7/10/14
to shiny-...@googlegroups.com
Definitely.

chris...@metricaid.com

unread,
Jul 16, 2014, 4:44:47 PM7/16/14
to shiny-...@googlegroups.com
Hello all,

I have been following this topic with great interest since I have been experiencing the same issue with respect to proxying via Apache.  

My colleague was able to reproduce the behaviour under nginx, so this was most likely not an Apache-specific issue.

I noticed that a new package of shiny-server-1.2.0.360-amd64.deb was posted on July 14 (the problematic release was 359) but the "Shiny Server Installation" documentation has not yet been updated to reflect this.  I went ahead and installed the package and can confirm that the websockets proxying issue appears to be corrected with this release, both in Apache and nginx.


I suggest that you get yourself a copy of this package and try for yourself.

Regards,


Chris

Fereshteh Karimeddini

unread,
Jul 16, 2014, 11:11:52 PM7/16/14
to shiny-...@googlegroups.com
Chris,

Thanks for trying the new package and your update.
Yes, shiny-server-1.2.0.360-amd64.deb fixes the proxying issue. We are in the process of testing this build. But for anyone interested, please feel free to install it, and let us know if you notice any issues.

Fereshteh

Jan Stanstrup

unread,
Jul 22, 2014, 7:05:51 AM7/22/14
to shiny-...@googlegroups.com
Works for me too now with the newest server.

plam...@gmail.com

unread,
Aug 14, 2014, 10:22:42 PM8/14/14
to shiny-...@googlegroups.com
Strangely, with Shiny Server v1.2.1.362  and apache2.2 and Ubuntu 14.04.1, 
I'm having the same behavior as Eilidh Hyslop.

If I go to http://internalserver/shiny/sample-apps/hello/ the app runs correctly,
but if I go to http://internalserver/shiny/ I get the shiny-server landing page, but the hello app doesn't work - 'Not Found The requested URL /sample-apps/hello/ was not found on this server.' 

Is this still a known shiny-server issue?  Or is it me?

Frznkljn Stwphwn

unread,
Aug 17, 2014, 1:42:24 PM8/17/14
to shiny-...@googlegroups.com
correction: apache 2.4.7

Frznkljn Stwphwn

unread,
Aug 19, 2014, 3:27:21 PM8/19/14
to shiny-...@googlegroups.com
The problem seems to be involved with apache2.
I get the same misbehavior Ubuntu 13.10 (with apache 2.4.6, and (still) Shiny Server v.1.2.1.362).

Also, where can I find previous versions of Shiny Server?

I'd really appreciate any feedback on this.
Thanks.

Fereshteh Karimeddini

unread,
Aug 19, 2014, 3:56:57 PM8/19/14
to shiny-...@googlegroups.com
I am able to reproduce the issue. We are looking into the fixing the problem.

But (as you have noticed with the sample-apps) you should be able to directly access the applications. For example with default configuration of Shiny Server, applications located in /srv/shiny-server directory and being served on port 3838 can be accessed via Apache port 80 as follows: 


Best,
Fereshteh

Frznkljn Stwphwn

unread,
Aug 19, 2014, 6:14:50 PM8/19/14
to shiny-...@googlegroups.com
Ok thanks for addressing that, Fereshteh. Now that I know that, I can move on.
And yes, I can directly access the applications, so not a big deal.

Much appreciated,
Stephen
Reply all
Reply to author
Forward
0 new messages