How do I let nginx know I'm using rails?

How do I let nginx know I’m using rails when I’m not using passenger but instead system installed nginx standalone with rails apps

Set up a reverse proxy in nginx, pointed from port [80,443] to whatever port your application server [puma, unicorn, webrick] is listening at.

Walter

Not exactly the answer I was looking for If I’m using rails with nginx system install, not the passenger nginx module, then how does the nginx webserver know that I’m running RoR apps because the problem is that nginx is looking for resource routes as subdirectories of /public

NGINX on its own cannot "run" Rails, because it is a simple httpd server. Rails needs an application server -- puma, unicorn, passenger -- to be a bridge between http and Rack protocols. Rails is a Rack application, under all the layers, and cannot host anything all by itself. Don't be confused by the fact that passenger can run as an Apache or NGINX plugin. That's just an implementation detail. Passenger can run as a stand-alone application server, too.

The pattern is this: Application Server starts up, accepts connections at some port, like 12345. NGINX or Apache or whatever Web Server starts up, accepts connections at 80 or 443 or both. A "reverse proxy" is configured in the Web Server configuration, and when a request comes in that matches it, the request is proxied to the Application Server. The response from the Application Server is then proxied back through the Web Server to the requesting browser.

1. Figure out which Application Server you want to use to run your Rails application, and configure it to start at system start, and to restart when you need it to (every time you update your Rails code). 2. Google "how do I configure a reverse proxy in NGINX". Do what you see in the results.

That's how you set this up.

Walter

Certbot was erroring out on Passenger statements in nginx.conf so I decided not to use Passenger anymore, just nginx, I thought I could do that but you say no I can’t Is that right?

Passenger is an application server that can either run as a plug-in to a web server, just like fastcgi or mod_php, or as a stand-alone server. When it runs as a stand-alone server, it actually uses an embedded copy of nginx as part of its code—but don’t let that confuse you. It’s still an application server, running as a separate process from the ‘http’ nginx server that is listening for requests from browsers. That ‘http’ server needs to be configured with a reverse proxy to the application server.

And an aside: Passenger is the best-documented, easiest to use application server I have ever used. I would not be so quick to run away from it. Figure out what your certbot issue is and fix that. You have a lot more work ahead of you to use a different approach.

Walter