0

I've got a local server configured with Nginx, PHP5-FPM, MySQL and some other stuff. I'm hosting two sites.

  • One static website using Twitter Bootstrap and a theme: at www.example.com
  • One WordPress blog: at blog.example.com

I know I can do the same with just a WordPress site, but the question is other. I can access the two websites from the outside (with my smartphone and my data connection, for example), but the server has (obviously) a unique IP address, and when I enter an http://192.168.1.50 (for example), it shows the first site I created, the static one.

I must disable that one in Nginx (deleting the dynamic link at /etc/nginx/sites-enabled/) and restarting the Nginx server to be able to access the second one (but only that one) from inside my LAN, and the same happens if I want to access back the first site.

Is there anyway to be able to access both sites from within my LAN?

  • Why don't you just access the sites by name? – Michael Hampton Mar 16 '14 at 22:35
  • Within the network? You mean editing /etc/hosts to "deceive" my local machine? – javipas Mar 16 '14 at 22:37
  • Yes, either by editing /etc/hosts or installing your own DNS server. – Tero Kilkanen Mar 16 '14 at 23:59
1

One of the possible solutions is actually to edit your local machine's hosts file (OS X, Windows and Linux have it in different locations) file to redirect those DNS to the local IP. In my case

192.168.1.50 example.com
192.168.1.50 www.example.com
192.168.1.50 blog.example.com

After saving that changes, you can accesss that URLs in your LAN without problems. Thanks for the suggestions, Michael Hampton/Tero Kilkanen ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.