Answer the question
In order to leave comments, you need to log in
Nginx/Passenger + Rails in a container?
Hello. Tell me please. I have a configured server under CentOS, according to the instructions
Now I want to transfer it to a Docker container. As if the question is that according to these instructions, I myself Nginx starts the Rails server with Passenger.
server {
listen 80;
server_name yourserver.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/myapp/code/public;
# Turn on Passenger
passenger_enabled on;
passenger_ruby /path-to-ruby;
}
Answer the question
In order to leave comments, you need to log in
The Passenger code is in one container, nginx in another and will reverse to the first one. It is advisable to put the static separately so that you can feed nginx.
Minimum Dockerfile:
FROM ruby:2.5-alpine
ADD . /app
WORKDIR /app
RUN bundle install
CMD ["bundle", "exec", "passenger", "start"]
version: '2'
services:
passenger:
build: ./
restart: always
#ports:
# - 3000:3000 (для дебага)
nginx:
image: nginx:mainline-alpine
restart: always
volumes:
#- ./nginx.conf:/etc/nginx/nginx.conf
- ./nginx-site.conf:/etc/nginx/conf.d/passenger.conf
#- /path/to/static/:/path/in/container/
proxy_pass http://passenger:3000;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question