• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

2 Nginx Virtual Servers on one physical server behind HAPROXY

Scheduled Pinned Locked Moved Cache/Proxy
1 Posts 1 Posters 169 Views
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 Sep 11, 2020, 3:00 AM

    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
    1 out of 1
    • First post
      1/1
      Last post
    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
      This community forum collects and processes your personal information.
      consent.not_received