How to configure NGINX to use multiple subdomains on local network to service more than one application?

I have the following setup on the same network:

  • windows computer with local IP 192.168.1.23
  • arch server with local IP 192.168.1.15
    • homarr dashboard app on port 9000
    • nextcloud app on port 9001
    • gitea app on port 9002

The apps are running on Docker containers on the server and are accessible on the windows computer using the following URLs http://192.168.1.15:9000/, http://192.168.1.15:9001/, http://192.168.1.15:9002/.

Now, I wish to configure an NGINX reverse proxy in order to access the various services by typing http://gitea.test.dev/, http://homarr.test.dev/, http://nextcloud.test.dev/.

In order to do that locally, I modified the host files on both platforms:

# windows
192.168.1.15 test.dev
192.168.1.15 gitea.test.dev
192.168.1.15 homarr.test.dev
192.168.1.15 nextcloud.test.dev

# linux
127.0.0.1 localhost
127.0.0.1 gitea.localhost
127.0.0.1 homarr.localhost
127.0.0.1 nextcloud.localhost

On the archlinux server, I can access the individual services at that point using the above method. However, I am unable to access those services from the windows computer using http://<service name>.test.dev/-like URLs, although that is expected behavior for now.

I then configured and started an NGINX service using the following configuration:

# /etc/nginx/nginx.conf
user http;
worker_processes auto;
worker_cpu_affinity auto;

events {
    multi_accept on;
    worker_connections 1024;
}

http {
    charset utf-8;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    server_tokens off;
    log_not_found off;
    types_hash_max_size 4096;
    client_max_body_size 16M;

    # MIME
    include mime.types;
    default_type application/octet-stream;

    # logging
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log debug;

    # load configs
    # include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

And the directory /etc/nginx/sites-enabled/ contains links to the individual services’ configurations.

# /etc/nginx/sites-enabled/homarr.localhost.conf
server {
        listen 80;
        server_name homarr.localhost;
        location / {
                proxy_pass http://localhost:9000;
        }
}
# /etc/nginx/sites-enabled/nextcloud.localhost.conf
server {
        listen 80;
        server_name nextcloud.localhost;
        location / {
                proxy_pass http://localhost:9001;
        }
}
# /etc/nginx/sites-enabled/gitea.localhost.conf
server {
        listen 80;
        server_name gitea.localhost;
        location / {
                proxy_pass http://localhost:9002;
        }
}

Those are, I believe, very bare-bone proxy_pass configurations. But I would expect them to work as intended. Now, my problem is that only one of these services is available from the windows computer using http://test.dev/ or http://<service>.test.dev/>. It seems to me like the default_server is the only one that is made available because the available service always follows the alphabetical ordering of the service names, and surely that is the order in which they are loaded by the include statement of the configuration.

Do you have any idea of why my individual services can’t all be serviced at the same time ? And is there any way to have a working configuration for the intended purpose of having all three services available on different subdomains on the local network ?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật