0

I will like to host OwnCloud on my own machine, and access it via localhost (I don't know yet if this is possible, but if it's not, then the question remains valid, this is just to give you a better idea of the situation), however, I'm not completely sure that I'll be the only one being able to access it.

From looking at other similar questions, for example here ("How can I access my localhost server from other computers?"), I found that there is some configuration you have to do first if you want others to be able to access your localhost, and they even have to be in the same network.

However, in this other question ("How can I access my localhost from my Android device?"), I find that you can do it easily without any configuration.

Then the problem is, how to make sure no one, except my machine, can access the localhost?

  • This is off-topic for stackoverflow, but: it looks like owncloud needs a webserver to run on. You would just configure that webserver to only serve localhost (127.0.0.1). E.g. for apache: http://httpd.apache.org/docs/1.3/bind.html – Blorgbeard Nov 01 '17 at 16:48
  • Note: localhost (127.0.0.1) is only accessible to your own machine, by definition. OwnCloud would only be accessible to other machines if it was serving other addresses, (192.168.*.* or whathaveyou). – Blorgbeard Nov 01 '17 at 16:51
  • @Blorgbeard I'm sorry for not being clear enough, I **want** it to just serve localhost, I don't want any synchronization aspect of it, it would just be to use the calendar. – Dariel Rudt Nov 01 '17 at 16:54
  • 1
    Yes, I understand that. If you serve on localhost, no-one else can access it. So, do that. – Blorgbeard Nov 01 '17 at 16:57
  • @Blorgbeard Okay, thank you for your help, however, there is something I'm missing here, since the best voted answer to the second link in my question, says that from a phone you could access that localhost if you know the computer IP address, is that right? how to avoid that? – Dariel Rudt Nov 01 '17 at 17:00
  • From that answer: "If both your desktop and phone are connected to the same WiFi (or any other local network), then use your desktop IP address assigned by the router (**not localhost and not 127.0.0.1**)". Explanation: Your computer has (at least) two IP addresses: 127.0.0.1 (localhost, accessible ONLY by that machine) and your internal network IP, which may look like 192.168.0.* or 10.0.0.*, depends on your setup. Server software that listens for connections only from 127.0.0.1 cannot be accessed by other machines. – Blorgbeard Nov 01 '17 at 17:08

1 Answers1

0

If you have Apache, put Listen 127.0.0.1:80 on the configuration file and restart Apache.

Nginx is almost the same. Put listen 127.0.0.1:80; on the config file and restart Nginx.

After restarting your webserver, issue a netstat -an A | find "80" on Windows, or netstat -patune | grep 80 on Linux and see if the service is running only on 127.0.0.1. On my Linux I see something like this (notice 127.0.0.1:80):

tcp   0  0 127.0.0.1:80    0.0.0.0:*    LISTEN   0      9711    -

And only programs running on the same computer can access it now. You phone cannot, your router cannot, nobody outside your computer can even know that the port 80 is listening. Even knowing the IP, the port, and belonging to the same network is not possible to connect to it.

ThoriumBR
  • 930
  • 12
  • 25