So I finished configuring my own owncloud 9.1 server with Linux Ubuntu Server 16.04 and I told a friend to download the owncloud client and connect to my localhost ip, but he somehow can't access it since it says "time expired". I searched fo the same error on this forum but I couldn't find a fix to it. I do know I need to do port forwarding, but I don't really know whichs ports I should open etc..
Could you help me?
If you use https, this should be 443 by default, for normal http it's 80.
That second screen capture looks like you are trying to access the server's LAN address from outside the LAN. That won't work. Your friend will need to use your WAN address. The ports you forwarded on your router should point to the server's LAN IP address, not your friend's ownCloud client.
Please note that if your connection to your ISP uses DHCP then your WAN IP address might change, sometimes frequently. You might want to considering using a dynanic DNS name service such as FreeDNS. Then a dynamic dns client can keep a hostname updated with your current IP address. If you can get that set up properly your friend would just need to know the hostname and url. (Example: https://fictional_host/owncloud/)