-1

I recently installed Wordpress on my home server running Arch Linux. Everything else works smoothly except that when try to access the server externally, the style sheet is not rendered. I have read my distribution's wiki and indeed I found a solution. It says it is because my hostname is not mapped to the ip address correctly and I should either change the /etc/hosts file or set up a proxy server https://wiki.archlinux.org/index.php/Wordpress#Appearance_is_broken_.28no_styling.29. However, due to my poor understanding on networking and server adminstration, I have no idea what to do? Can someone show me what exactly do I have to do?

Thank you

lpan
  • 103
  • 2

1 Answers1

0

To fix this you need first the hostname for your server. You get that with:

~]# uname -n   
myhost.xyz

Now you need the IP address for your machine, you get that with the ip command. Your output can differ depending on how many interfaces you have on your server.

~]# ip addr show 
10: eth0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 38:ea:a7:93:b4:b0 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.25/16 brd 172.29.255.255 scope global bond0
inet6 fe80::3aea:a7ff:fe93:b4b0/64 scope link
   valid_lft forever preferred_lft forever

What you need is the second part of the inet line, in this case 192.168.10.25.

Now you need to add that information to the /etc/hosts file. The easiest way to this is using echo and append like this.

echo "<your Hostname>   <your IP>" >> /etc/hosts

After you have done this, it should work immediately.

dadriel
  • 106
  • 5
  • It still does not work. The wiki suggests to set up a proxy server do you think it may be a good idea? – lpan Jul 24 '15 at 14:05
  • A proxy is a much more complicated setup, can you please give me the content of your /etc/hosts? That way I can verify the changes are correct in the file. – dadriel Jul 24 '15 at 14:12
  • '192.168.0.30 mysql.wordpress my_server – lpan Jul 24 '15 at 14:15
  • 127.0.0.1 localhost.localdomain localhost – lpan Jul 24 '15 at 14:15
  • ::1 localhost.localdomainn localhost – lpan Jul 24 '15 at 14:16
  • this is all I have and plus what should i enter for $database-hostname during the wordpress installation? The default value is localhost – lpan Jul 24 '15 at 14:17
  • localhost should be fine. There looks to be an extra ' in front of the first line? That would be causing issues. It might also be that there is some caching interfering, so you might try a reboot of the server and see if that helps. – dadriel Jul 24 '15 at 14:29
  • the extra ' was a typo. I clear cache every time I reloaded my website. The issue may be the same as suggested here https://wordpress.org/support/topic/page-displays-fine-locally-but-not-externally-wamp but I have no idea how to change the wp setting – lpan Jul 24 '15 at 14:33
  • Something complicatin your case is the fact, that you don't have a public IP address for your machine, but only using the port forwarding on your router. I'm not 100% sure about WP, but it probably means that you have to follow that advice and change your setting your DynDNS URL. Here it tells you how https://codex.wordpress.org/Changing_The_Site_URL you should be able to do it without having to edit anything in the database – dadriel Jul 24 '15 at 19:01