简体   繁体   中英

Shiny server ProxyPass using apache

My shiny server runs on my VPS without any issues (on Ubuntu, via Apache). So that's great. :) However, what I now try to achieve is the following (sorry for not using the correct terminology here, this is new for me):

Instead of sharing my apps via https://www.example.com:3838/appname , I would like to use https://www.example.com/appname (is this called port forwarding? aka 'getting rid of port 3838').

It is important to note that I do not want the shiny server to 'take over' my homepage as https://www.example.com serves my own personal site.

I tried the codeblock shared by Chris Beeley to be included in /etc/apache2/sites-enabled/000-default-le-ssl.conf , but that does not work. However, what does work to some degree is if I adjust the code as follows

Original code

ProxyPreserveHost On
ProxyPass /shinyapps http://0.0.0.0:3838/shinyapps
ProxyPassReverse /shinyapps http://0.0.0.0:3838/shinyapps
ServerName localhost

Adjusted code

ProxyPreserveHost On
ProxyPass /foo http://0.0.0.0:3838/foo
ProxyPassReverse /foo http://0.0.0.0:3838/foo
ServerName localhost

Yes, my app called foo can now be reached by www.example.com/foo; but this implies that I need to add the names of all my apps in this codeblock.

Any suggestions? Thank you.

Also, I am sorry if this question turns out to be duplicate.

PS. All incoming connections to http are already redirected to https

That should work:

ProxyPreserveHost On
ProxyPass /(.*)$ http://0.0.0.0:3838/$1
ProxyPassReverse /(.*)$ http://0.0.0.0:3838/$1
ServerName localhost

Check out this link: https://httpd.apache.org/docs/trunk/rewrite/intro.html

I think you've misunderstood the way the URLs are structured. You need to point to

ProxyPass /foo http://0.0.0.0:3838/foo

As you have done, but foo is the name of the directory of apps.

So take all the application folders that you have, and put them inside foo.

Now the URL will be

https://example.org/foo/app1
https://example.org/foo/app2

Etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM