2 apps behind nginx

Hi guys.
I don’t know nginx. A devops guy set one up back a while for our app.

this is the nginx.conf he setup.

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
	worker_connections 768;
         multi_accept on;
}

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	include /etc/nginx/mime.types;
	default_type application/octet-stream;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;
	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;
	gzip on;
	gzip_disable "msie6";


        proxy_cache_path  /home/html_catch  levels=1:2 keys_zone=appbacktocartcocatch:2m max_size=50m;
        proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
        proxy_cache_valid 200 302 10m;
        proxy_cache_valid 404 1m;




	include /etc/nginx/sites-enabled/*.conf;




}

I can see that it includes some other files like this one which is for the app specifically

#proxy_cache_path  /home/html_catch  levels=1:2 keys_zone=appbacktocartcocatch:2m max_size=50m;
#proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
#proxy_cache_valid 200 302 10m;
#proxy_cache_valid 404 1m;


upstream appbacktocartco {
#        server localhost:3000;
	server localhost:3001;
}


server {
     listen 145.239.24.196:80;
     server_name app.backtocart.co;

     location / {

       proxy_cache appbacktocartcocatch;

       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-Proto $scheme;
       proxy_http_version 1.1;
       proxy_set_header   Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_pass         http://appbacktocartco;
       proxy_read_timeout 90;
    }


    listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/app.backtocart.co/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.backtocart.co/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot

}

Now I just need to run another app like this on port 5000. I just copied this file tried changing a few things, then restarted nginx but got some errors I don’t understand. Can you help me with this?

Maybe you should ask for help on Nginx forums instead of Meteor, no ?

1 Like