./mh-nginx/conf.d/default.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
server { listen 443 ssl; server_name localhost; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; location / { root /etc/nginx/dist; index index.html index.htm; } } |
./docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 |
version: '3.3' services: nginx: container_name: mhc_nginx image: nginx:1.23.1-alpine restart: always volumes: - ./mh-nginx/conf.d/:/etc/nginx/conf.d/ - ./mh-nginx/ssl/:/etc/nginx/ssl/ - ./mh-nginx/dist/:/etc/nginx/dist/ ports: - "7750:443" |
Start
- Tạo key SSL
1 |
openssl req -days 3650 -x509 -newkey rsa:2048 -sha256 -nodes -keyout ./mh-nginx/ssl/key.pem -out ./mh-nginx/ssl/cert.pem -subj "/C=/ST=/L=/O=/OU=web/CN=medihome.vn" |
- Stop port 7750 in your computer
- Run docker: docker compose up -d
- Try access: https://localhost:7750
to test