Run Multiple Site from one IP with  reverse proxy Nginx

Run Multiple Site from one IP with reverse proxy Nginx

How to run multiple sites on one web-server using Nginx by creating a virtual host.

Also shows how to host dynamic content using port 8080 and 8081

Free Trial on Digital Ocean:

Helpful sites:

commands used during video:

sudo apt install nginx

—show content in “site enable”

unlink default

— create new conf file in conf.d

— past server block into .conf file
server {
listen 80 default_server;

location / {
proxy_set_header X-Real-IP $remote_addr;


server {
listen 80;

location / {
proxy_set_header X-Real-IP $remote_addr;

nginx -t

systemctl reload nginx

systemctl status nginux

22 thoughts on “Run Multiple Site from one IP with reverse proxy Nginx

  1. hi…

    i need help from you iam working on java JSP page on the tomcat server i can access all post and get method in 80 port but not working in 443 what happens.. and what is the problem can you please explain me or fix this problem

  2. this is how to proxy to different sites based on server name. This means you should run now nginx plus two more servers. If you want to run multiple servers on the same server you just need a different root folder and remove the proxy commands

  3. Is there a way for my domain path to point to another domain? For example, I want my site: that will point to a different domain when a user loads up "" and the user is NOT redirected, they still see that url, but just a different domain is presented?

  4. Great video, thanks for sharing 👍. I am much more familiar with Apache so it was neat to see the equivalent on Nginx.

  5. Hi did you type the two block server in the same file new_sites.conf or they are separated ? Gracias Juan (Spanish Name)

  6. I am trying to link multiole mqtt websockets on various domains… like>mqtt1>mqtt2…etc
    Please acknowledge me

  7. so each website you host on the machine will "own" a different port right?
    in your example had port 80
    and had 8080
    if i was to add another website i would have had to choose another port ?

  8. So you can't just add the two sites to the "default" file? What is the contents of "new_sites.conf"? You edited your video and didn't make it clear.

  9. Question , ive got my IP address , got 2 apps running 1 on 5000 and one on 5100 , i want to be ip/Api redirect to 5000 and ip/Api2 to redirect to 5100 , how do i config that?

Leave a Reply

Your email address will not be published. Required fields are marked *