Nginx Configuration for Meteor Deployment

My question is how to get Nginx to redirect the domain (www.example.com/app) to the meteorite application on the same server. Nginx runs on port 80, and Meteor runs on port 4000 on the same computer.

Here are the details: I am trying to use Nginx to host an application made by a meteor on my own server. I cannot get Nginx to redirect my domain name to port 4000, where a meteor can pick it up and process the web page.

The latest configuration for Nginx for the proxy port:

server {
    listen 80 default_server;
    listen [::]: 80 default_server ipv6only = on;
    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri / = 404;    
    }

    location /app {
        rewrite ^/app(.*) /$1 break;
        proxy_pass http://127.0.0.1:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header X-Forwarded-For $remote_addr;
   }
}

With this configuration, when I access the meteor application when

www.example.com/app

all requests for * .js and * .css files are sent to

www.example.com/xxxxxxxxxxxx.js

instead it should be like

www.example.com/app/xxxxxxxxxxxx.js

- , Nginx Meteor,

www.example.com/app

+4
1

:

    rewrite ^/app(.*) /$1 break;

URL-, www.example.com/app/xxxxxxxxxxxx.js, www.example.com/xxxxxxxxxxxx.js

0

Source: https://habr.com/ru/post/1625138/


All Articles