I have to specifiy port otherwise the website doesnt work

Here are some additional details that step you through transfering a LAN-based wordpress site into an externally accessible site as well enabling editing the wordpress site from inside the LAN.

Two important keys are router/firewall modifications and the “wait 10+ minutes” after making the changes at the end.

-using ssh to log into your server (nano is a server preinstalled text editor)
-$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
-add lines just after

update_option('siteurl','http://your.site.url:port/yourblog');
update_option('home','http://your.site.url:port/yourblog');

-refresh your web browser using your external site url

http://your.site.url:port/yourblog
-$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
-remove those lines you just added (or comment them out)
-access your router (these steps are for pfSense, other routers should have similar settings to look for/watch out for)
-add to firewall/nat table a line like this

    wan/tcp/port/LAN.server.IP/80

-add to firewall/rules table a line like this

    tcp/*/port/LAN.server.IP/port/*

-uncheck the box at System/advanced/network address translation/Disable NAT Reflection

   "Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks. Note: Reflection only works on port forward type items and does not work for large ranges > 500 ports."

Then go do something for ten minutes and when you get back see if the external url http://your.site.url:port/yourblog from a LAN browser brings the page up correctly.

You can read more about permalink Here