LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-08-2024, 11:42 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Rep: Reputation: 10
Post Why does Nginx look for the default path instead of containers?


Hello,
I have two containers running on ports 3000 and 3001:
Code:
# ss -tupln
Netid    State     Recv-Q     Send-Q         Local Address:Port          Peer Address:Port    Process                                    
tcp      LISTEN    0          4096                 0.0.0.0:80                 0.0.0.0:*        users:(("docker-proxy",pid=88600,fd=4))    
tcp      LISTEN    0          4096                 0.0.0.0:3000               0.0.0.0:*        users:(("docker-proxy",pid=87578,fd=4))    
tcp      LISTEN    0          4096                 0.0.0.0:3001               0.0.0.0:*        users:(("docker-proxy",pid=87600,fd=4))    
tcp      LISTEN    0          4096               127.0.0.1:35751              0.0.0.0:*        users:(("obfs4proxy",pid=538,fd=3))        
tcp      LISTEN    0          4096                    [::]:80                    [::]:*        users:(("docker-proxy",pid=88606,fd=4))    
tcp      LISTEN    0          4096                    [::]:3000                  [::]:*        users:(("docker-proxy",pid=87585,fd=4))    
tcp      LISTEN    0          4096                    [::]:3001                  [::]:*        users:(("docker-proxy",pid=87608,fd=4))
Nginx configuration is as follows:
Code:
server {
        listen 80;
        server_name localhost.comm;
        error_log  /var/log/nginx/error.system-default.log;
        access_log /var/log/nginx/access.system-default.log;        

        location node1.localhost.comm {
            proxy_pass http://Node1:3000;
            proxy_redirect     off;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
        }

        location node2.localhost.comm {
            proxy_pass http://Node2:3000;
            proxy_redirect     off;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
        }
    }
The /etc/hosts file is as follows:
Code:
127.0.0.1       node1.localhost.comm
127.0.0.1       node2.localhost.comm
But I can't see any of the containers:
Code:
# curl node1.localhost.comm
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.25.4</center>
</body>
</html>
The Nginx log is as follows:
Code:
2024/05/08 14:14:58 [error] 28#28: *1 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 192.168.32.1, server: localhost.comm, request: "GET / HTTP/1.1", host: "node1.localhost.comm"
What is wrong?

Thank you.

Last edited by Jason.nix; 05-09-2024 at 05:02 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The rocky road to better Linux software installation: Containers, containers, containers LXer Syndicated Linux News 0 11-27-2021 10:49 AM
LXer: Containers Running Containers with LinuxKit LXer Syndicated Linux News 0 06-09-2017 06:52 AM
LXer: Containers running Containers LXer Syndicated Linux News 0 04-30-2017 04:30 PM
nginx/1.4.1 '/etc/nginx/sites-available/default' missing Jalalabee Linux - Newbie 0 06-05-2013 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration