add nginx service

This commit is contained in:
2025-05-07 13:06:42 +03:30
parent ed6dcd0f29
commit 372ca655a2
3 changed files with 51 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ POSTGRES_DB=""
POSTGRES_PASSWORD="" POSTGRES_PASSWORD=""
NOTIFICATION_SERVER_PATH="" NOTIFICATION_SERVER_PATH=""
NOTIFICATION_SERVICE_URL=""
NOTIFICATION_SERVER_DB="" NOTIFICATION_SERVER_DB=""
NOTIFICATION_SERVER_USER="" NOTIFICATION_SERVER_USER=""
NOTIFICATION_SERVER_PASSWORD="" NOTIFICATION_SERVER_PASSWORD=""
@@ -20,4 +21,6 @@ REDIS_PORT=""
NEXT_JS_PATH="" NEXT_JS_PATH=""
NEXT_PUBLIC_VERSION="" NEXT_PUBLIC_VERSION=""
NEXT_PUBLIC_API_URL="" NEXT_PUBLIC_API_URL=""
NEXT_PUBLIC_SERVER_SOCKET_URL="" NEXT_PUBLIC_SERVER_SOCKET_URL=""
NGINX_CONFIG_PATH=""

View File

@@ -1,4 +1,16 @@
services: services:
nginx:
image: nginx:1.27.5-alpine3.21
container_name: nginx
restart: always
tty: true
ports:
- "8888:80"
volumes:
- ${NGINX_CONFIG_PATH}:/etc/nginx/conf.d
- ${NGINX_CONFIG_PATH}/logs:/var/log/nginx/
backend_db: backend_db:
image: postgres:17-alpine3.21 image: postgres:17-alpine3.21
container_name: backend_db container_name: backend_db
@@ -71,6 +83,7 @@ services:
- NODE_ENV=production - NODE_ENV=production
- DB_HOST=notification_db - DB_HOST=notification_db
- DB_PORT=5432 - DB_PORT=5432
- SERVICE_URL=${NOTIFICATION_SERVICE_URL}
- DB_USERNAME=${NOTIFICATION_SERVER_USER} - DB_USERNAME=${NOTIFICATION_SERVER_USER}
- DB_PASSWORD=${NOTIFICATION_SERVER_PASSWORD} - DB_PASSWORD=${NOTIFICATION_SERVER_PASSWORD}
- DB_DATABASE=${NOTIFICATION_SERVER_DB} - DB_DATABASE=${NOTIFICATION_SERVER_DB}

34
nginx/crm.conf Normal file
View File

@@ -0,0 +1,34 @@
server {
listen 80;
charset utf-8;
location ^~ /server {
rewrite ^/server(/.*)$ $1 break;
include fastcgi_params;
fastcgi_pass laravel:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/laravel/public/index.php;
}
location / {
proxy_pass http://nextjs:3106;
}
location /notification {
proxy_pass http://notification_server:3023;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
# listen 443 ssl; # managed by Certbot
# ssl_certificate /etc/letsencrypt/live/crm.witel.ir/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/crm.witel.ir/privkey.pem; # managed by Certbot
# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}