Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    2 Nginx Virtual Servers on one physical server behind HAPROXY

    Scheduled Pinned Locked Moved Cache/Proxy
    1 Posts 1 Posters 340 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      ahmza
      last edited by

      If you take a look at these to sites you will see my issue,

      https://blog.ahmza.com
      https://shop.ahmza.com

      I have setup two virtual nginx servers on ubuntu 20.04 server and I have HAproxy setup on my pFsense firewall

      Here is the nginx config for the shop sub domain

      server {
          listen 80;
          listen [::]:80;
      
          server_name shop.ahmza.com;
          root /var/www/shop;
      
          location / {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $http_host;
              proxy_pass http://127.0.0.1:2368;
      
          }
      
          location ~ /.well-known {
              allow all;
          }
      
          client_max_body_size 50m;
      }
      

      Here is the nginx config for the blog sub domain

      server {
          listen 80;
          listen [::]:80;
      
          server_name blog.ahmza.com;
          root /var/www/ghost/system/nginx-root;
      
          location / {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $http_host;
              proxy_pass http://127.0.0.1:2368;
      
          }
      
          location ~ /.well-known {
              allow all;
          }
      
          client_max_body_size 50m;
      }
      

      I cant see the problem here because they have separated root folders, i think its to do with the proxy stuff but i cant figure it out

      1 Reply Last reply
      Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
      Privacy Policy · Cookie Policy