Nginx returns 404

250 views Asked by At

I started my project (api-template) run on localhost (pid 8907) with supervisor.

enter image description here

Here is my project's supervisor.conf file:

[program:api-template]
command=/home/rezuan/api-template/.build/x86_64-unknown-linux-gnu/release/Run serve --env production
directory=/home/rezuan/api-template/
user=rezuan
stdout_logfile=/var/log/supervisor/%(program_name)-stdout.log
stderr_logfile=/var/log/supervisor/%(program_name)-stderr.log

Here is my nginx sites-avilable/default file:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        try_files $uri @proxy;

        location @proxy {
                proxy_pass http://127.0.0.1:8080;
                proxy_pass_header Server;
                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_pass_header Server;
        }

}

Nginx is successfully run, but doesn't "redirect" to my localhost project and returns 404 error. When I run a project without nginx it works successfully.

[enter image description here4 [enter image description here5

0

There are 0 answers