shiny-server.conf listen on 80 error.

1,218 views
Skip to first unread message

Elodie C

unread,
Feb 4, 2014, 9:19:09 AM2/4/14
to shiny-...@googlegroups.com
Hi, 

I have several shiny apps in directory /var/shiny-server/www on Ubuntu 12.04 and R 3.0.2.
All directories and files have  these permissions : "-rwxr-xr-x  1 root root"

I want to configure the file "shiny-server.conf" in "/etc/shiny-server" directory :


server {
  listen 80;
  location / {
    # Run this location in 'app_dir' mode, which will host a single Shiny
    # Application available at '/srv/shiny-server/myApp'
    site_dir /var/shiny-server/www;
    directory_index on;
    #user_apps on;
  }
  location /Myapp1 {
    # Run this location in 'app_dir' mode, which will host a single Shiny
    # Application available at '/srv/shiny-server/myApp'
    app_dir /var/shiny-server/www/Myapp1;
    
  }
 location /Myapp2 {
    # Run this location in 'app_dir' mode, which will host a single Shiny
    # Application available at '/srv/shiny-server/myApp'
    app_dir /var/shiny-server/www/Myapp2;
    
  }
}


I stopped and restarted shiny-server but I have an error message  : 404 error page

Not Found

The requested URL /Myapp1 was not found on this server.

Apache/2.2.22 (Ubuntu) Server at XXXXXX Port 80


I have also an apache server on port 80 and the url "localhost" give me my other php/perl app

Can you help me for writing correctly the configuration file ? 

Thanks

Elodie

Elodie C

unread,
Feb 4, 2014, 9:37:35 AM2/4/14
to shiny-...@googlegroups.com
Other informations
shiny-server --version
Shiny Server v0.3.6
Node.js v0.10.25


Elodie C

unread,
Feb 4, 2014, 9:39:09 AM2/4/14
to shiny-...@googlegroups.com
It's don't works with listen 3838; but it's works without shiny-server.conf file.

Fereshteh Karimeddini

unread,
Feb 4, 2014, 11:45:29 AM2/4/14
to shiny-...@googlegroups.com
Elodie,

We can certainly help you with that. But before getting into this I was wondering if there is any reason that you prefer to stay with Shiny Server version 0.3.6. If not I suggest that you download and install the latest available open source version from here:


Please refer to this page for install instructions:

And here for the Admin Guide with details on how to setup and configure your server:

We can help you with your issue whether you stay with the older version or upgrade to new version; just let us know.

Best,
Fereshteh

Fereshteh Karimeddini

unread,
Feb 4, 2014, 3:56:38 PM2/4/14
to shiny-...@googlegroups.com
Elodie,

We have now released Shiny Server version 1.0, which you can download from:


The Admin Guide is located here:



Fereshteh

Elodie C

unread,
Feb 5, 2014, 5:11:18 AM2/5/14
to shiny-...@googlegroups.com
Thanks, 

So I updated my shiny-server : 

shiny-server --version
Shiny Server v1.0.0.42
Node.js v0.10.21

All my Shiny apps are located in /srv/shiny-server folder.

I created a file .conf by command line  : sudo cp /opt/shiny-server/config/default.config /etc/shiny-server/shiny-server.conf

My Shiny-server.conf file is  : 

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 80;

  # 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;
  }
  location /NHU133app {
    app_dir /srv/shiny-server/NHU133app;
  }
}


This file works well but if I change IP port 3838 by 80, i have an error message page  : 

Not Found

The requested URL /NHU133app/ was not found on this server.

Apache/2.2.22 (Ubuntu) Server at XXXXXXXXX Port 80


Fereshteh Karimeddini

unread,
Feb 5, 2014, 11:20:39 AM2/5/14
to shiny-...@googlegroups.com
Elodie,

Thanks for upgrading to the latest version, and for the information. It would be easier to help you with any issue you may run into now that you are using the latest version.

Now that you have posted your issue again, it is more clear that your issue is most likely a conflict of ports; you are using port 80 for Apache on the same server, right? Then, to best of my knowledge, you won't be able to use if for Shiny Server. Can you reconfigure your Apache to use a different port?

Besides that, I noticed a little problem in your configuration files that will cause a problem for you if you restart your Shiny Server.

- Please change your shiny-server.conf as follows: (note the line I have added to define log_dir)

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 80;

  # 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;
  }
  location /NHU133app {
    app_dir /srv/shiny-server/NHU133app;
              log_dir /var/log/shiny-server; 
  }
}

- Save the file
- Restart Shiny Server  (sudo restart shiny-server)


Best,
Fereshteh

j...@riskcede.co.za

unread,
Apr 6, 2016, 6:21:53 AM4/6/16
to Shiny - Web Framework for R
Hi Guys

I know this is an old post, but im struggling with something very similar.

I got my shiny server setup to work without nginx.

My shiny-server.config file is below.

It all works fine until you leave out the slash at the end of the url, that crashes the server.
(www.website.co.za/apps/app1/ vs www.website.co.za/apps/app1 )

Ive tried to add 'rewrite ^(/shiny/[^/]+)$ $1/ permanent;' to the shiny config file, but that doesnt seem to work.

Any ideas how to make the apps work with or without the slash in the url?

Regards
Jan




run_as jan;
log_dir /var/log/shiny-server;



server {
   listen 80;

  location / {
     app_dir /home/jan/home;

  location /apps/ {
    site_dir /home/jan;
    #directory_index on;

    #rewrite ^(/shiny/[^/]+)$ $1/ permanent;

}
}
}
 

Erik Westlund

unread,
Apr 6, 2016, 8:43:19 AM4/6/16
to j...@riskcede.co.za, Shiny - Web Framework for R
Taking a quick look -- Why is app dir "/home/jan/home"?

Is that correct? 

I've personally found it easiest to use proxy_pass in nginx to the app on the shiny port. 

Sent from my iPhone
--
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/61713ca7-6b6f-48a5-8aa8-238edfd2b0a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RiskCede

unread,
Apr 6, 2016, 8:55:54 AM4/6/16
to Erik Westlund, Shiny - Web Framework for R
Hi Erik

Yes, guess its a bad choice of names.

so home/jan is were all my apps are stored on the server. I log into rstudio with user = jan.

The second home is one app’s name.

The idea is that when someone go directly to the website then the app in the ‘home’ dir opens.

and then from there all other apps will open in /apps/

so www.website.co.za opens the app in home dir and www.website.co.za/apps is where all the other apps are.


I couldnt figure out how to do this on nginx, that is, have one app on the landing page and all the rest somewhere else.

Regards
Jan
Reply all
Reply to author
Forward
0 new messages