Change document root to RStudio_AMI
It's on amazon server, so I checked the following post: Changing Apache source document on AWS EC2 does not work and How to edit httpd.conf file in AMAZON EC2 or in general: How to change apache server root directory? Well, the information provided has helped me so far. The only file I could find in the etc / apache2 folder is the following:
Edit: content of config file: "Alias / javascript / usr / share / javascript /
FollowSymLinks MultiViews Options "
I asked two months ago on my site: http://www.louisaslett.com/RStudio_AMI/ but got no response.
My question is, how can I change the document root on the RStudio AMI server so that I can change the directory on the rstudio login page in the root to - say - domain.com/login and have the target page + other folders in the root (domain.com) ...
Thanks for your help!
Edit: Following Frederic Henri's answer and edit:
Here is the content of my rstudio.conf file.
location / {
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
access_log /var/log/nginx/rstudio-access.log;
error_log /var/log/nginx/rstudio-error.log;
}
Assuming I have an index.html file in the /home/idx/index.html directory, how would I then modify the file. The following didn't work for me:
proxy_pass http://localhost/home/idx;
proxy_redirect http://localhost/home/idx/ $scheme://$host/;
Or:
proxy_pass /home/idx;
proxy_redirect /home/idx/ $scheme://$host/;
and where should I set up my login redirection in rstudio. Thank!
source to share
You are right and looking in the right place if you are using the apache2 / httpd web server; but in case of RStudio AMI, it uses nginx webserver , so all configuration is saved in/etc/nginx
You can look at Configure nginx with multiple locations with different root folders on a subdomain to see how you can work with the conf file
In your current configuration, it is defined mainly by three locations:
-
http://<web_server_ip>/
The conf file used for this case is /etc/nginx/RStudioAMI/rstudio.conf
It handles the whole request and forwards http: // localhost: 8787 where rstudio is running.
-
http://<web_server_ip>/julia
The conf file used for this case is /etc/nginx/RStudioAMI/julia.conf
It handles the whole request and forwards http: // localhost: 8000 where julia is running.
-
http://<web_server_ip>/shiny
The conf file used for this case is /etc/nginx/RStudioAMI/shiny.conf
It handles the whole request and forwards http: // localhost: 3838 where brilliant runs.
For example, you can have a main location (it's just /
pointing to a specific folder) and change rstudio.conf to handlehttp://<web_server_ip>/rstudio
EDIT
where would i configure my rstudio login redirect to
If you want the rstudio login page to be accessible from http://<server>/rtudio
(for example) you will need to change in `/ etc / nginx / RStudioAMI / rstudio.conf``
location /rstudio/ {
proxy_pass http://localhost:8787/;
proxy_redirect http://localhost:8787/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
access_log /var/log/nginx/rstudio-access.log;
error_log /var/log/nginx/rstudio-error.log;
}
If you want to point the primary http://<server>/index.html
pointing to /home/idx/index.html
, you need to change to /etc/nginx/sites-enabled/RStudioAMI.conf
and specify the primary location pointing to your root element
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
index index.html;
location = / {
root /var/www/html;
}
include /etc/nginx/RStudioAMI/*.conf;
}
Note. Every time you make changes to the nginx config file, you need to restart nginx. with: /etc/init.d/nginx restart
.
source to share