This Docker image hosts multiple web applications using Nginx, each served over a different port with SSL and basic authentication enabled. The following instructions will guide you through setting up and running this image.
This Docker image is configured to serve multiple static websites using Nginx. The sites included are:
Each site is served on a separate port with SSL encryption and requires basic authentication.
Ensure that the web pages are prepared and located in the following directories within the Docker image:
/var/www/adarkroom/var/www/dol/var/www/fc-pregmod/var/www/sandboxelsThe Nginx configuration is set up to support multiple sites, each with its own server block configuration file located in /etc/nginx/conf.d/.
Example configuration for one site (web1.conf):
server {
listen 8081 ssl;
server_name localhost;
root /var/www/web1;
index index.html;
ssl_certificate /etc/nginx/certs/certificate.crt;
ssl_certificate_key /etc/nginx/certs/private.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
location / {
try_files $uri/ $uri =404;
}
}
Modify the listen port and root directory for other sites accordingly.
Create an .htpasswd file on your host machine to enable basic authentication:
htpasswd -c /path/on/host/.htpasswd username
Place your certificate files on the host machine in a secure directory:
your_certificate.crtyour_private.keyBuild the Docker image using the following command:
docker build -t my-nginx-multi-site .
Run the Docker container with the appropriate port mappings and file mounts:
docker run -d \
-p 8081:8081 \
-p 8082:8082 \
-p 8083:8083 \
-p 8084:8084 \
-v /path/on/host/your_certificate.crt:/etc/nginx/certs/certificate.crt:ro \
-v /path/on/host/your_private.key:/etc/nginx/certs/private.key:ro \
-v /path/on/host/.htpasswd:/etc/nginx/conf.d/.htpasswd:ro \
bai0012/nginx-multi-site
.htpasswd and SSL private key files are kept secure and only accessible by authorized personnel.Content type
Image
Digest
sha256:dc14039b5…
Size
76.1 MB
Last updated
over 1 year ago
docker pull bai0012/nginx-multi-site