nginx server to serve static content, fixes #5
This commit is contained in:
parent
2d1293320d
commit
d19f0ebc42
|
@ -5,12 +5,12 @@ services:
|
||||||
container_name: postal
|
container_name: postal
|
||||||
command: run
|
command: run
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:80:5000
|
|
||||||
- 127.0.0.1:25:25
|
- 127.0.0.1:25:25
|
||||||
depends_on:
|
depends_on:
|
||||||
- "mysql"
|
- "mysql"
|
||||||
- "rabbitmq"
|
- "rabbitmq"
|
||||||
volumes:
|
volumes:
|
||||||
|
- static_assets:/opt/postal/public
|
||||||
- ./data/postal/assets:/opt/postal/public/assets
|
- ./data/postal/assets:/opt/postal/public/assets
|
||||||
- ./data/postal/config:/opt/postal/config
|
- ./data/postal/config:/opt/postal/config
|
||||||
environment:
|
environment:
|
||||||
|
@ -34,3 +34,19 @@ services:
|
||||||
- RABBITMQ_DEFAULT_USER=postal
|
- RABBITMQ_DEFAULT_USER=postal
|
||||||
- RABBITMQ_DEFAULT_PASS=changeme
|
- RABBITMQ_DEFAULT_PASS=changeme
|
||||||
- RABBITMQ_DEFAULT_VHOST=/postal
|
- 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