What is ngnix? Does it make my website publicly available? Or it has some other purpose?
For further actions, you may consider blocking this person and/or reporting abuse
What is ngnix? Does it make my website publicly available? Or it has some other purpose?
For further actions, you may consider blocking this person and/or reporting abuse
Marco -
Robin van der Knaap -
Sergio Peris -
Theodor Heiselberg -
Top comments (5)
Sort of. It has several purposes but one of the common ones is to act as a web server.
Generally speaking, a web server is a program that runs in the background all the time (sometimes called a "service" or a "daemon"). It just sits there and waits for a request. When it gets a request (usually from a web browser like Chrome), it figures out what the request is for, then processes it, and sends a response.
A request is usually for a URL like blah.com/blah.html. The web server then figures out if blah.html is a file on the system and if so, it sends back the contents of blah.html as a response.
There are many types of requests, which is where a web server admin has to configure the web service appropriately to handle them all (sometimes you don't want certain requests and sometimes there are requests that have to use another plugin or engine to process).
As far as "publicly" goes - a web server does not determine whether the public outside can access the site. To make a site "public", you need to have all public IP and -usually- you want a domain name to go with it (because it is easier to remember my website.com than it is to remember 89.45.132.76) and those need to be mapped to the web server. So the web server needs to know that it is accepting requests for that IP and domain in order to respond correctly.
However, a web server can just as easily run only on your machine (private) and not be public.
That is a -very- broad explanation and there are a lot more details but that should give you a general idea.
I want to know how to get my local website be visible to public. Can I just use my public IP to access it without any setups?
Not usually. There is almost always some setup and several things to consider.
Your public IP usually changes unless you have paid extra to your ISP to have a static one. So you usually have to have a way to work around that (e.g. dynamic DNS).
If you're on a home internet connection, your ISP might block you from doing this. A lot of ISPs don't want their customers to be serving up lots of traffic.
Most people are still behind a firewall using NAT. What that means is that your public IP isn't the same as your local network IP. Basically, IPv4 (IP addresses with 4 numbers and a dot between them like 1.2.3.4) only had a couple billion IP addresses (from 0.0.0.0 to 255.255.255.255). Since there many, many more internet-connected devices than public IP addresses, a technology called NAT made it possible to create a private network with its own private IP addresses. So your public IP might be 1.2.3.4 but your computer's IP address might be 192.168.1.10. The traffic that goes to 1.2.3.4 goes to your router or firewall device, and then it has to be routed to your machine. So you usually have to configure your firewall/router to route traffic on ports 80 (the normal port for HTTP) and 443 (HTTPS) to your computer.
Then you have to consider that if your computer is down or updating or rebooting or the web server isn't running, then nobody can access your site.
You also have to consider that if you have any vulnerabilities in your website or you don't keep the web server updated or if it's not configured correctly, you could be vulnerable to hackers who might be able to access other files on your hard drive or even erase things.
So there's quite a few things to consider. It is why people who are getting started with websites usually pay for basic hosting services. Those other companies have everything already configured and they take care of almost all of those problems for you.
So while you -can- host from your local computer, it's usually a bad idea and almost always takes setup.
Thanks!
If you have a stable public IP, you can make your local website public. If you have it and your webserver is running, then you'll be available to access your website in the browser using
http
protocol, fe.http://18.197.136.105
.If you want to make your website available under some domain, you have to register it globally in DNS. Usually,
.com
is cheap and costs about $10 per year. When you'll register it, you can redirect all request for this domain to your IP.But, as Jonathan mentioned, your home IP in most cases is unstable and it can be changed from time to time. Moreover, to have a stable website, you have to have your local machine and webserver always running, so you either need to run your private computer always up or have dedicated webserver at home. But it doesn't worse it 😉 Better host your website somewhere remote, in the cloud, fe. AWS EC2 or DigitalOcean. It costs about $5 per month for the cheapest instance.