If you want people to reach your website hosted on a Raspberry Pi, you will need to route incoming web traffic to the Pi. This means you'll need to change some settings on your home router, mainly the firewall settings. If you haven't installed a web server on your Raspberry Pi, that might be a good place to start: Setting up an nginx web server on a Raspberry Pi.
First, access your router's settings by entering 192.168.1.1 in your browser's address bar. That is the default address for the web interface of most home routers. When you go there, you should see something like this, with the maker of your router's name on it:
Next, find the firewall settings, which are under Firewall > Virtual Servers for my router. You will probably have to enter your router's administrative password at this point. This keeps other people from making changes to your router.
Next, we want to change it so that HTTP web traffic is routed to the Raspberry Pi. You'll need to know your Pi's IP address, which can be found by entering this command in the Pi's terminal:
Next, find the firewall settings, which are under Firewall > Virtual Servers for my router. You will probably have to enter your router's administrative password at this point. This keeps other people from making changes to your router.
Next, we want to change it so that HTTP web traffic is routed to the Raspberry Pi. You'll need to know your Pi's IP address, which can be found by entering this command in the Pi's terminal:
ifconfig
You're looking for something like this:
inet addr:192.168.1.33
And the IP address is 192.168.1.33 for my Raspberry Pi. Remember that address, because you will be putting it in your router's settings.
The Raspberry Pi's IP address needs to go in the box called something like "Private IP Address". The first record I have entered here is the one for my Pi:
These fields tell us that the virtual server is enabled for port 80 traffic inbound to my home's IP address, and will be routed to port 80 on my Raspberry Pi. You can now check to see if web traffic is getting to your Raspberry Pi by visiting your home's IP address in your browser. To get your home IP address, look for a "Wan IP" in your router's settings or go to Google and enter "my ip". Once you get that address, put it in your browser and see if your Pi serves a webpage. Note that you'll need a web server set up on your Pi for this to work.
These fields tell us that the virtual server is enabled for port 80 traffic inbound to my home's IP address, and will be routed to port 80 on my Raspberry Pi. You can now check to see if web traffic is getting to your Raspberry Pi by visiting your home's IP address in your browser. To get your home IP address, look for a "Wan IP" in your router's settings or go to Google and enter "my ip". Once you get that address, put it in your browser and see if your Pi serves a webpage. Note that you'll need a web server set up on your Pi for this to work.
Another thing to remember is that many residential internet service providers (ISPs) block the default HTTP port, which is 80. I use Cox Communications for my ISP, and they do not allow servers to listen and serve traffic on port 80. It's even trickier because a Raspberry Pi set up to listen on port 80 will work from within your home when you are connected to the same router, but will not work outside your local network. This fooled me into thinking I was listening on port 80 with my Pi for any traffic coming my way.
To get around an ISP that doesn't allow port 80 traffic, you can host websites from your Raspberry Pi on an alternative port. I also have set my Pi up to receive requests on port 83, which is not blocked by my ISP. Here is my record for port 83 in my router's firewall settings: