Host Multiple Website in Single VPS
Have you ever wander
can I serve multiple website using only one VPS ?
Yes you can and here is how.
Photo by Eric Prouzet on Unsplash
How I do it
I believe everyone have their own way to serve multiple website using only single VPS. As for me, I use nginx as reverse proxy, so I can redirect incoming request to my localhost. I follow this nginx.conf configuration and change it as needed. Using the same configuration, I can setup several server blocks so I have several hosts on a single server.
nginx.conf
http { # omitted for brevity
server { listen 80; server_name yourdomain.com;
location / { proxy_pass http://127.0.0.1:5555 # your localhost } }
server { listen 80; server_name yourseconddomain.com;
location / { proxy_pass http://127.0.0.1:6666 # your second localhost } }}
Next is you need to setup your DNS management to point your domain to the same VPS and voila, you done.