Set Application Domain Name with Shiny Server

October 23, 2016

(This article was first published on R – R-statistics blog, and kindly contributed to R-bloggers)

Guest post by AVNER KANTOR

I used the wonderful tutorial of Dean Attall to set my machine in Google cloud. After I finished to configure it successfully I wanted to redirect my domain to the Shiny application URL. This is a short description how you can do it.

The first step is changing the domain server to your server supplier. You can find here a guide for several suppliers how to do it. I used Godaddy and Google Cloud DNS:


The tricky part is the setting up Nginx virtual hosts. The DigitalOcean tutorial helped me again.

We will create virtual hosts in etc/nginx/sites-available. In this directory you can find the default file you created when you set the environment (here is my file). Now you should add config file named after you domain name. Let’s assume it is Here is the config file you should have:

$ sudo nano /etc/nginx/sites-available/
server {
  listen 80;
  listen [::]:80;
  root /var/www/html;


  location / {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

It’s important to check that default_server option is only enabled in a single active file – in our case: deafult. You can do it by grep -R default_server /etc/nginx/sites-enabled/.

In order to enable the server block we will create symbolic links from these files to the sites-enabled directory, which Nginx reads from during startup.

$ sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

If no problems were found, restart Nginx to enable your changes:

sudo systemctl restart nginx

Now that you are all set up, you should test that your server blocks are functioning correctly. You can do that by visiting the domains in your web browser:

To leave a comment for the author, please follow the link and comment on their blog: R – R-statistics blog. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)