Skip to content

Commit 70aca0a

Browse files
committed
Update docker-compose and nginx configuration for improved environment setup and SSL support
1 parent a23250d commit 70aca0a

2 files changed

Lines changed: 50 additions & 9 deletions

File tree

docker-compose.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ services:
99
volumes:
1010
- app_code:/var/www/html
1111
- ./.env:/var/www/html/.env
12+
env_file:
13+
- .env
1214
environment:
13-
APP_ENV: production
14-
DB_CONNECTION: mysql
1515
DB_HOST: mysql
16-
DB_PORT: 3306
17-
DB_DATABASE: tim
18-
DB_USERNAME: root
19-
DB_PASSWORD: root
16+
REDIS_HOST: redis
2017
depends_on:
2118
- mysql
19+
- redis
2220
networks:
2321
- tim
2422

@@ -27,8 +25,8 @@ services:
2725
container_name: mysql
2826
restart: unless-stopped
2927
environment:
30-
MYSQL_ROOT_PASSWORD: root
31-
MYSQL_DATABASE: tim
28+
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
29+
MYSQL_DATABASE: ${DB_DATABASE}
3230
volumes:
3331
- dbdata:/var/lib/mysql
3432
- ./laravel.sql:/docker-entrypoint-initdb.d/laravel.sql
@@ -44,9 +42,11 @@ services:
4442
restart: unless-stopped
4543
ports:
4644
- "80:80"
45+
- "443:443"
4746
volumes:
4847
- app_code:/var/www/html:ro
4948
- ./nginx.conf:/etc/nginx/conf.d/default.conf
49+
- /etc/ssl:/etc/ssl
5050
depends_on:
5151
- app
5252
networks:

nginx.conf

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,45 @@ server {
1818
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
1919
fastcgi_param PATH_INFO $fastcgi_path_info;
2020
}
21-
}
21+
}
22+
23+
server {
24+
listen 443 ssl;
25+
server_name tim.phamloc.top;
26+
27+
# SSL Configuration
28+
ssl_certificate /etc/ssl/certs/cloudflare.pem;
29+
ssl_certificate_key /etc/ssl/private/cloudflare.key;
30+
ssl_client_certificate /etc/ssl/certs/cloudflare.crt;
31+
ssl_verify_client on;
32+
33+
# SSL Settings
34+
ssl_protocols TLSv1.2 TLSv1.3;
35+
ssl_ciphers HIGH:!aNULL:!MD5;
36+
ssl_prefer_server_ciphers on;
37+
38+
# Client Upload Size
39+
client_max_body_size 100M;
40+
41+
# timeout configurations
42+
proxy_connect_timeout 300;
43+
proxy_send_timeout 300;
44+
proxy_read_timeout 300;
45+
send_timeout 300;
46+
47+
48+
location / {
49+
proxy_pass http://app:9000;
50+
proxy_http_version 1.1;
51+
proxy_set_header Upgrade $http_upgrade;
52+
proxy_set_header Connection 'upgrade';
53+
proxy_set_header Host $host;
54+
proxy_set_header X-Real-IP $remote_addr;
55+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
56+
proxy_set_header X-Forwarded-Proto $scheme;
57+
proxy_cache_bypass $http_upgrade;
58+
59+
# Cho phép giữ kết nối lâu hơn
60+
proxy_buffering off;
61+
}
62+
}

0 commit comments

Comments
 (0)