Can't Access Local Site pages from Local Network

January 11, 2020 114 views
Nginx Networking

I have a website using Nginx server located on Ubuntu i need to access this website from the other network machines, i configured the hosts file well, the Nginx server working well, the postgres sql working well, the firewall is disabled, and it works well on the local machine and site is fine with the local host, but the problem is when i’m trying to open the site on another local network machine using the hosted machine IP it just resolve the machine IP with the site name as it written on the hosts file but it doesn’t bring any of the site pages and give an error that (example.com’s server IP address could not be found.)
Please help to to solve this issue.
Thanks…

1 Answer

Hello,

I would recommend creating Nginx server blocks for each individual site and in each server, block make sure to define your domain names as the server_name.

You can follow the steps here on how to set up Nginx server blocks:

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

Hope that this helps!
Regards,
Bobby

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu...
  • Hello Dear;
    I really appreciate your response to me but unfortunately everything in the link you provided i already made it before but the problem still as it’s; the site working fine on the server machine but when trying to open it on another machine on the network it covert the server IP to the site name but it give this error:-
    (This site can’t be reached example.com’s server IP address could not be found. ERRNAMENOT_RESOLVED)
    note: it just one site on the server.

    • Hello,

      What I could suggest is trying to ping the domain name from some of the other machines on the network, for example:

      ping example.com
      

      If you don’t get a response back, then try to add an entry to your hosts file on the other machines on the network as well, and then try pinging the domain again.

      Let me know how it goes!
      Regards,
      Bobby

      • Thanks a lot dear it works with editing the hosts file on the other network machine, but i’m sorry is it logic to edit the hosts file on each machine will work on the site?
        sorry for the annoyance…

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!