title: Shiny Server Error on webpage: An error has occurred The application failed to start. The application exited during initialization
body: <p>I am trying to setup R Shiny Server on my Amazon Linux AWS EC2 instance and am getting the following error:</p>
  
  <p>An error has occurred</p>
  
  <p>The application failed to start.</p>
  
  <p>The application exited during initialization.</p>
  
  <p>I did a sudo shiny-server to see what happens and see the error EADDRINUSE:</p>
  
  <pre><code>$ sudo shiny-server
  [2017-01-29 13:21:22.724] [INFO] shiny-server - Shiny Server        v1.5.1.834 (Node.js v6.9.1)
  [2017-01-29 13:21:22.728] [INFO] shiny-server - Using config file   "/etc/shiny-server/shiny-server.conf"
  [2017-01-29 13:21:22.764] [INFO] shiny-server - Starting listener on   0.0.0.0:80
  [2017-01-29 13:21:22.771] [ERROR] shiny-server - HTTP server error (0.0.0.0:80): listen EADDRINUSE 0.0.0.0:80
  [2017-01-29 13:21:22.771] [INFO] shiny-server - Shutting down worker processes
  </code></pre>
  
  <p>I have verified that Shiny, rmarkdown and, Shiny Server and R are properly installed on my instance:</p>
  
  <pre><code>R --version
  R version 3.2.2 (2015-08-14) -- "Fire Safety"
  Copyright (C) 2015 The R Foundation for Statistical Computing
  Platform: x86_64-redhat-linux-gnu (64-bit)
  
  R is free software and comes with ABSOLUTELY NO WARRANTY.
  You are welcome to redistribute it under the terms of the
  GNU General Public License versions 2 or 3.
  For more information about these matters see
  http://www.gnu.org/licenses/.
  
  &gt; library(shiny)
  &gt; library(rmarkdown)
  &gt;
  </code></pre>
  
  <p>I have also checked the network connection on my ec2 instance:</p>
  
  <pre><code>$ sudo netstat --tcp -nlpa | grep 80
  tcp        0      0 0.0.0.0:80                  0.0.0.0:*                    LISTEN      1875/shiny-server
  </code></pre>
  
  <p>My ec2 instance network security group:</p>
  
  <pre><code>$ aws ec2 describe-security-groups --group-name launch-wizard-7
  {
  "SecurityGroups": [
      {
          "IpPermissionsEgress": [
              {
                  "IpProtocol": "-1", 
                  "PrefixListIds": [], 
                  "IpRanges": [
                      {
                          "CidrIp": "0.0.0.0/0"
                      }
                  ], 
                  "UserIdGroupPairs": [], 
                  "Ipv6Ranges": []
              }
          ], 
          "Description": "launch-wizard-7 created 2017-01-28T14:22:51.817-05:00", 
          "IpPermissions": [
              {
                  "PrefixListIds": [], 
                  "FromPort": 80, 
                  "IpRanges": [
                      {
                          "CidrIp": "0.0.0.0/0"
                      }
                  ], 
                  "ToPort": 80, 
                  "IpProtocol": "tcp", 
                  "UserIdGroupPairs": [], 
                  "Ipv6Ranges": []
              }, 
  </code></pre>
  
  <p>(there's another entry but that ssh into my own machine so I won't put that information)</p>
  
  <p>and here is my shiny-server.conf file from /etc/shiny-server/shiny-server.conf</p>
  
  <pre><code>$ 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;
   }
  }   
  </code></pre>
  
  <p>Any help would be really appreciated. I tried to let AWS listen to request for port 80 for all ip addresses and for the shiny-server as I thought maybe both services shouldn't be listening to the same port but that didn't work. Am just trying to deploy the sample-app that came with shiny server.</p>
  
  <p>url: <a href="http://34.198.107.126/sample-apps/hello/" rel="nofollow noreferrer">http://34.198.107.126/sample-apps/hello/</a></p>