Start wordpress

pull/142/head
Baohua Yang 2022-03-23 16:43:56 -07:00
parent 70f0a87901
commit 456d2aede7
8 changed files with 290 additions and 1 deletions

View File

@ -45,6 +45,9 @@ See [hyperledger_fabric](hyperledger_fabric) for more details.
## [kafka](kafka)
Start a simple kafka service for testing.
## [lnmp_wordpress](lnmp_wordress)
Deploy nginx, mysql, php + wordpress.
## [mongo_cluster](mongo_cluster)
Start 3 mongo instance to make a replica set.
@ -61,7 +64,7 @@ The web UI will listen on local 8081 port.
## [nginx_auth](nginx_auth)
Use nginx as a proxy with authentication for backend application.
## [packetbeat_ek](packetbeat_ek)
## [packetbeat_elk](packetbeat_elk)
Demo the packetbeat, elasticsearch and kibana.
Some kibana [dashboard config](https://github.com/elastic/beats-dashboards) files are included.

View File

@ -0,0 +1,18 @@
# Wordpress
WORDPRESS_LOCAL_PATH=./wordpress_data
WORDPRESS_UPLOADS_CONFIG=./wordpress_config/uploads.ini
WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_USER=wordpress
WORDPRESS_DB_PASSWORD=dbpassword@123
# MySQL
MYSQL_LOCAL_PATH=./db_data
MYSQL_DATABASE=${WORDPRESS_DB_NAME}
MYSQL_USER=${WORDPRESS_DB_USER}
MYSQL_PASSWORD=${WORDPRESS_DB_PASSWORD}
MYSQL_ROOT_PASSWORD=rootpassword@123
# Nginx
NGINX_CONF=./nginx_conf/default.conf
NGINX_SSL_CERTS=./nginx_ssl
NGINX_LOGS=./nginx_logs/nginx

View File

@ -0,0 +1,41 @@
# LNMP+Wordpress
Deploy nginx, mysql, php + wordpress.
## Usage
1. Start the db container.
```bash
docker-compose --env-file ./.env up -d db
```
2. Start the nginx and wordpress container.
```bash
docker-compose --env-file ./.env up -d wordpress nginx
```
3. Access `https://localhost`
## Data path
* `wordpress_data`: data for wordpress.
* `wordpress_config`: config for wordpress.
* `db_data`: config for wordpress.
## Generate ssl certs
```bash
openssl req -x509 -outform pem -out server.pem -keyout privkey.pem \
-newkey rsa:4096 -nodes -sha256 -days 3650 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
```
## Common wordpress configs
* permanent link;
* theme: astra;
* plugins: Contact Form 7, Updraft, Sucuri;

View File

@ -0,0 +1,70 @@
version: '3.1'
services:
wordpress: # wordpress
image: wordpress:5-fpm # fastcgi
container_name: wordpress
restart: always
env_file:
- .env
environment:
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST:-db:3306}
- WORDPRESS_DB_NAME=${WORDPRESS_DB_NAME:-wordpress}
- WORDPRESS_DB_USER=${WORDPRESS_DB_USER:-wordpress}
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD:-dbpassword@123}
ports:
- "8080:80"
volumes:
- ${WORDPRESS_LOCAL_PATH:-./wordpress_data}:/var/www/html
- ${WORDPRESS_UPLOADS_CONFIG:-./wordpress_config/uploads.ini}:/usr/local/etc/php/conf.d/uploads.ini
depends_on:
- db
db: # database
image: mysql:8
container_name: db
restart: always
env_file:
- .env
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
- MYSQL_USER=${MYSQL_USER:-wordpress}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-dbpassword@123}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-rootpassword@123}
volumes:
- ${MYSQL_LOCAL_PATH:-./db_data}:/var/lib/mysql
command:
- '--default-authentication-plugin=mysql_native_password'
nginx:
# default ports 80, 443 - expose mapping as needed to host
image: nginx:1
container_name: nginx
restart: unless-stopped
env_file:
- .env
ports:
- "80:80" # http
- "443:443" # https
volumes:
- ${WORDPRESS_LOCAL_PATH:-./wordpress_data}:/var/www/html
- ${NGINX_CONF:-./nginx_conf/default.conf}:/etc/nginx/conf.d/default.conf
- ${NGINX_SSL_CERTS:-./nginx_ssl}:/etc/ssl:ro
- ${NGINX_LOGS:-./nginx_logs/nginx}:/var/log/nginx
depends_on:
- wordpress
- db
adminer: # lightweighted mysql manage tool, bypasses nginx
# default port 9000
image: adminer:4-fastcgi
container_name: adminer
restart: unless-stopped
depends_on:
- db
ports:
- "9000:9000"
volumes:
wordpress:
db:

View File

@ -0,0 +1,71 @@
# default.conf
# redirect to HTTPS
server {
listen 80;
listen [::]:80;
server_name $host;
location / {
# update port as needed for host mapped https
rewrite ^ https://$host:8443$request_uri? permanent;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name $host;
index index.php index.html index.htm;
root /var/www/html;
server_tokens off;
client_max_body_size 75M;
# update ssl files as required by your deployment
ssl_certificate /etc/ssl/server.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
# logging
access_log /var/log/nginx/wordpress.access.log;
error_log /var/log/nginx/wordpress.error.log;
# some security headers ( optional )
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass wordpress:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off; access_log off;
}
location = /favicon.svg {
log_not_found off; access_log off;
}
location = /robots.txt {
log_not_found off; access_log off; allow all;
}
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}

View File

@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC51tn/S/Hz/Azp
d2Xm40mUIm5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St58l9qASlIkCXk6HV/zN9lBZbGmNeaL3i7B5Co6jTEE+z
0jW/snkvU5N1KEFCygMzqzPQA5xZAMC/qtnuIEAr6KUgv9BVsZTiYuUWUPcja2So
J91hBk+RA+JXORYOWPYL2KMKRlKVcC0jumArCjszxwdnhbtRlCIKN/HIEwQoDm7B
VNpn2XjeiQ29FKdhPWD/JAEOwVEK1evwq/83ZLgFHrgictFEM1EaLCtEtWrYvpVF
PCMnp0/zy5CrI/WRjXNJsh5YkPbnW7WgTmQl0QwFhRrCQYH24QqB8CclwvZoQViv
A1FogOjYv0SFYL3C5JuOqU5KWH3r/V4Xl7QCPob4b5Wgglbh/YqjYrgHx0WdD4aV
d4tiY0vAEgrLviAGhzWt1A8uI34Iwwm3zO4lLIWx6yDCfnSwbHzto9cg2TDsClu+
b4oLWwkZMef7dXMwZ8fMs6d344uWX0+fGLFNomqA8t9xF54dkHe10InzxnJ3cl3O
JeiK63kCICv9oJoOZco+aUCJQFKG+WJ1bzVbqofFr66HARGTYqkV+340Als4TX8t
l9Pv6oLN6QpH
-----END CERTIFICATE-----

View File

@ -0,0 +1,5 @@
file_uploads = On
memory_limit = 256M
upload_max_filesize = 75M
post_max_size = 75M
max_execution_time = 600