Merge pull request #6 from badjware/master
Add a nginx service to serve static assets
This commit is contained in:
commit
b42749fbb7
|
@ -5,12 +5,12 @@ services:
|
|||
container_name: postal
|
||||
command: run
|
||||
ports:
|
||||
- 127.0.0.1:80:5000
|
||||
- 127.0.0.1:25:25
|
||||
depends_on:
|
||||
- "mysql"
|
||||
- "rabbitmq"
|
||||
volumes:
|
||||
- static_assets:/opt/postal/public
|
||||
- ./data/postal/assets:/opt/postal/public/assets
|
||||
- ./data/postal/config:/opt/postal/config
|
||||
environment:
|
||||
|
@ -34,3 +34,19 @@ services:
|
|||
- RABBITMQ_DEFAULT_USER=postal
|
||||
- RABBITMQ_DEFAULT_PASS=changeme
|
||||
- RABBITMQ_DEFAULT_VHOST=/postal
|
||||
nginx:
|
||||
image: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 127.0.0.1:80:80
|
||||
links:
|
||||
- postal
|
||||
depends_on:
|
||||
- postal
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- static_assets:/opt/postal/public:ro
|
||||
- ./data/postal/assets:/opt/postal/public/assets:ro
|
||||
volumes:
|
||||
static_assets:
|
||||
|
||||
|
|
23
nginx.conf
Normal file
23
nginx.conf
Normal file
|
@ -0,0 +1,23 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
root /opt/postal/public;
|
||||
|
||||
location / {
|
||||
client_max_body_size 50M;
|
||||
try_files $uri $uri/index.html $uri.html @puma;
|
||||
}
|
||||
|
||||
location /assets {
|
||||
add_header Cache-Control max-age=3600;
|
||||
}
|
||||
|
||||
location @puma {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://postal:5000;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user