7.2 Sharing as a webpage
7.2.1 For temporary uses
Say I have a Shiny app on my desktop in my office and I’ll have a meeting in a conference room somewhere in my department. It might be a good choice to host the Shiny app temporarily on my desktop.
- Find out your IP address. To access your app from other computer, you need to know your IP address. For Windows system, use
ipconfigcommand in Command Prompt (
Win+ R, then input
cmdand Enter) . In linux, use
ifcondiginstead. Remember your IP4 Address, for example, mine is
10.26.52.173as shown in Figure 7.1.
- Run the following command on the machine hosting the Shiny app.
runApp(host = "0.0.0.0", port = 80)
The default value of
127.0.0.1 (localhost) which means that only the current machine can access it. To allow other clients to connect,
host need to be set to
- Now you can access the Shiny app by typing the IP address in your browser from other machines.
My IP address starts from
10, which means it is a private IP, so only people using the same private network as me can access it. Private IP usually have the following ranges:
192.168.0.0 - 192.168.255.255 (65,536 IP addresses) 172.16.0.0 - 172.31.255.255 (1,048,576 IP addresses) 10.0.0.0 - 10.255.255.255 (16,777,216 IP addresses)
If your IP is not a private IP, anybody using the Internet may have access to your Shiny app. You may consult the IT department of your organization for details.