3

Following the instructions at "blogdown: Creating Websites with R Markdown" https://bookdown.org/yihui/blogdown/, I used RStudio to create a blog and it is working with no problem on http://127.0.0.1:4321/. Thank you Yihui!

Happy with my new acquired skills, I wanted to show it off to the folks at home thru the local network. So the first thing I did was to first try on my computer http://192.168.1.4:4321 (my local IP address). It didn't work, got "This site can’t be reached."

Any hints?

Thank you

Note: Using Ubuntu 18.04, RStudio Version 1.1.423

Ben Cissé
  • 33
  • 3

1 Answers1

4

Try blogdown::serve_site(host = '0.0.0.0') to allow connections from outside networks (if your firewall permits). To know the differences between 127.0.0.1 and 0.0.0.0, you may see this post or this. You can also use 192.168.1.4 if you are sure this local IP won't change (sometimes it may change, e.g., after you restart the wireless router).

A word of caution: enabling others to access files on your computer may introduce security risks. Please do this only if you understand the consequences and trust the outside connections. In your case, it is probably fine (people outside of your home network shouldn't be able to visit your website served locally on your computer).

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
  • It worked perfectly! Indeed, access is limited to my home network. Now I can check out how it renders on my smartphone. Thank you Yihui! – Ben Cissé Sep 14 '18 at 11:51
  • Interesting to note that, at least in my case, using blogdown::serve_site(host = '0.0.0.0') seems to cause RStudio not to render the blog's content on the "Viewer" pane. – Ben Cissé Sep 14 '18 at 14:31
  • Yes, I noticed that too. I'm not sure if it is worth filing an issue to https://github.com/rstudio/rstudio. You can open the link in your web browser anyway. – Yihui Xie Sep 14 '18 at 17:31
  • If you `devtools::install_github('yihui/servr')`, the RStudio Viewer problem you mentioned should be resolved. – Yihui Xie Sep 14 '18 at 19:18
  • 1
    `devtools::install_github('yihui/servr')` solved the issue. I can now see the blog content on RStudio Viewer pane even when serving on 0.0.0.0. Thank you again for your help! :D – Ben Cissé Sep 14 '18 at 19:43