forked from 9652040795/aws-policies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-bitnami-official-wordpress-nginx
89 lines (68 loc) · 2.91 KB
/
docker-bitnami-official-wordpress-nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# https://serverfault.com/questions/735069/nginx-redirect-ip-to-domain-name
# https://hub.docker.com/r/bitnami/wordpress
# Create a network
docker network create bitnami-wordpress-tier
# Mariadb Setup
docker run --name mariadb --user=root -e MARIADB_DATABASE=bitnami_wordpress -e MARIADB_ROOT_PASSWORD="ausdermoitoeuropas" -v /root/mariadb:/bitnami --network="bitnami-wordpress-tier" --restart unless-stopped -d bitnami/mariadb:latest
# Phpmyadmin Setup
#docker run --name phpmyadmin --network="bitnami-wordpress-tier" --link mariadb:db -id -p 8080:80 --restart unless-stopped phpmyadmin/phpmyadmin
# Wordpress Setup
docker run --name bitnami-wordpress -u root --network="bitnami-wordpress-tier" -e WORDPRESS_DATABASE_NAME="bitnami_wordpress" -e WORDPRESS_DATABASE_USER="root" -e WORDPRESS_DATABASE_PASSWORD="ausdermoitoeuropas" --link mariadb:db -v /root/wordpress:/bitnami --restart unless-stopped -d bitnami/wordpress:latest
# Nginx Container
mkdir -p ~/ssl/certs
#2
mkdir -p ~/nginx/conf.d
#3
#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ~/ssl/certs/nginx-selfsigned.key -out ~/ssl/certs/nginx-selfsigned.crt
openssl req \
-new \
-newkey rsa:4096 \
-days 365 \
-nodes \
-x509 \
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \
-keyout ~/ssl/certs/nginx-selfsigned.key \
-out ~/ssl/certs/nginx-selfsigned.crt
#4
openssl dhparam -out ~/ssl/certs/dhparam.pem 2048
#5
cd ~/nginx/conf.d
#6
apt update -y 2> /dev/null
apt install -y vim 2> /dev/null
yum update -y 2> /dev/null
yum install -y vim 2> /dev/null
#7
echo '
server {
listen 80;
server_name dev.cloudgeeks.ca;
return 301 $scheme://dev.cloudgeeks.ca$request_uri;
}
server {
server_name dev.cloudgeeks.ca;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/certs/nginx-selfsigned.key;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:HIGH:!aNULL:!MD5;
location / {
proxy_set_header Host $host:$server_port;
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_redirect http:// https://;
proxy_pass http://bitnami-wordpress:8080;
# Required for new HTTP-based CLI
proxy_http_version 1.1;
proxy_request_buffering off;
}
}' > ~/nginx/conf.d/server.conf
#8
docker run --name nginx --network=bitnami-wordpress-tier --restart unless-stopped -v ~/ssl/certs:/etc/ssl/certs -v ~/nginx/conf.d:/etc/nginx/conf.d -p 443:443 -p 80:80 -d nginx
#END
# chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--