I'm running Shiny Server on an AWS EC2 (Ubuntu 16.4), and trying to configure an Apache2 server reverse proxy to serve port 3838 to the website's /apps sub-folder. I've opened port 3838 in the AWS security group, as well as ufw on the EC2. When I call the IP directly (http://x.x.x.x:3838/) it works fine, as when I call the EC2's default public DNS - http://ec2-x-x-x-x.region.compute.amazonaws.com:3838/.
But I've also set up a domain mydomain with a DNS provider and set to web forward from mydomain to the IP. When I call the root I get the correct apache page. When I call /apps/ the Welcome to Shiny Server! page comes through but the embedded demo shiny apps crash. Checking the log directory reveals:
# 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;
}
}
I think what the error is saying is that Shiny doesn't have permission to save its log in the default location (or location specified in the Shiny-Server configuration file, if you've added one.) Why it would have permission in one case but not the other is the puzzle.
Thanks open-meta. Actually it's the response to the cat call! I've edited the question to reflect. But I think it is definitely a user/permissions issue.
If I understand your issue right, you are talking about setting up an Apache proxy that does not seem to be working correctly. I would be curious if the following article helps:
First, I would check to be sure accessing the apps on the desired port my-domain.org:3838 works as expected. i.e. in this way you test shiny server without the proxy. Then you need to get the proxy to work and access at my-domain.org/apps/. Once the proxy is working, you technically will not need to "open" port 3838 to outside traffic. The internal proxy takes care of routing from 80 to 3838. Of course, you can leave 3838 open if you like, as well.
One last tidbit - it is possible to make shiny server listen directly on port 80 if you like. I.e. you do not need to have a proxy to get things listening on port 80. That's your call, though! Shiny Server v1.5.21 Configuration Reference
Yes I tried to implement those instructions, and apache crashed on restart. I'll try again and post response in a sec.
http://mydomain:3838 fails (empty response). I understood I'd need to implement a separate apache listener for that. But as I mentioned, http://[ip_address]:3838 does respond properly, as well as http://[aws_default_ec2_dns]:3838, so I know it works without the proxy.
Yes I need to run other stuff on the server so unfortunately listening on port 80 isn't possible.
OK so re-running through the official guide, I spotted it failed because:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
This led me to discover that mod_rewrite was deactivated, despite that activating this is in my setup script. So a simple sudo a2enmod rewrite has fixed the issue, and all now works fine.
If your question's been answered/resolved, would you mind choosing a solution (even if, as it seems in this case, it's your own response? (see FAQ below for how)
It makes it a bit easier to visually navigate the site and see which questions still need help.