Add nginx container
This commit is contained in:
parent
8cf8457a54
commit
bfe5dc6ff8
@ -2,6 +2,22 @@ version: '2.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: notes-nginx
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Brussels
|
||||||
|
volumes:
|
||||||
|
- ./frontend/dist:/usr/share/nginx/html
|
||||||
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./nginx/server.conf:/etc/nginx/server.conf
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
container_name: notes-mariadb
|
container_name: notes-mariadb
|
||||||
@ -24,6 +40,7 @@ services:
|
|||||||
build: ./api
|
build: ./api
|
||||||
container_name: notes-api
|
container_name: notes-api
|
||||||
ports:
|
ports:
|
||||||
|
# This is only for testing
|
||||||
- 8081:8081
|
- 8081:8081
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
|||||||
@ -3,5 +3,5 @@ export default function ({ $axios }) {
|
|||||||
console.log('Making request to ' + config.url)
|
console.log('Making request to ' + config.url)
|
||||||
})
|
})
|
||||||
|
|
||||||
$axios.setBaseURL('http://localhost:8081')
|
$axios.setBaseURL(process.env.API_URL)
|
||||||
}
|
}
|
||||||
|
|||||||
33
nginx/nginx.conf
Normal file
33
nginx/nginx.conf
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
include /etc/nginx/server.conf;
|
||||||
|
}
|
||||||
|
|
||||||
28
nginx/server.conf
Normal file
28
nginx/server.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#charset koi8-r;
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
rewrite ^/api/(.*) /$1 break;
|
||||||
|
proxy_pass http://api:8081/;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user