s'occuper de wordpress
This commit is contained in:
@@ -1,7 +1,17 @@
|
|||||||
FROM debian:bullseye
|
FROM debian:bullseye
|
||||||
RUN apt update -y
|
RUN apt-get update -y && \
|
||||||
RUN apt upgrade -y
|
apt-get upgrade -y && \
|
||||||
RUN apt install mariadb-server -y
|
apt-get install -y mariadb-server && \
|
||||||
|
mkdir -p /var/run/mysqld && \
|
||||||
|
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
|
||||||
COPY conf/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
|
COPY conf/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
COPY tools/script.sh /tools/script.sh
|
RUN mkdir -p /var/run/mysqld
|
||||||
ENTRYPOINT ["sh", "/tools/script.sh"]
|
RUN chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
|
||||||
|
COPY ./tools/mariadb.sh /mariadb.sh
|
||||||
|
|
||||||
|
RUN chmod +x /mariadb.sh
|
||||||
|
|
||||||
|
EXPOSE 3306
|
||||||
|
RUN ./mariadb.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/sbin/mysqld"]
|
||||||
@@ -1,7 +1,21 @@
|
|||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
datadir = /var/lib/mysql
|
|
||||||
socket = /run/mysqld/mysqld.sock
|
user = mysql
|
||||||
bind_address=*
|
|
||||||
|
socket = /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
port = 3306
|
port = 3306
|
||||||
user = mysql
|
|
||||||
|
datadir = /var/lib/mysql
|
||||||
|
|
||||||
|
key_buffer_size = 16M
|
||||||
|
|
||||||
|
max_allowed_packet = 16M
|
||||||
|
|
||||||
|
log_error = /var/log/mysql/error.log
|
||||||
|
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
collation-server = utf8mb4_general_ci
|
||||||
|
|
||||||
|
bind-address = 0.0.0.0
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -e "/var/lib/mysql/.done" ]; then
|
||||||
|
mysql_install_db --user=mysql --datadir=/var/lib/mysql
|
||||||
|
/usr/sbin/mysqld --skip-networking &
|
||||||
|
|
||||||
|
for i in {50..0}; do
|
||||||
|
if echo 'SELECT 1' | mysql &> /dev/null; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$i" -eq 0 ]; then
|
||||||
|
echo >&2 'MariaDB'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mysql -u root -e "CREATE DATABASE IF NOT EXISTS $SQL_DATABASE;"
|
||||||
|
|
||||||
|
mysql -u root -e "CREATE USER '$SQL_USER'@'%' IDENTIFIED BY '$SQL_PASSWORD';"
|
||||||
|
|
||||||
|
mysql -u root -e "GRANT ALL ON $SQL_DATABASE.* TO '$SQL_USER'@'%';"
|
||||||
|
|
||||||
|
mysql -u root -e "FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
|
mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$SQL_ROOT_PASSWORD');"
|
||||||
|
|
||||||
|
|
||||||
|
mysqladmin -u root -p$SQL_ROOT_PASSWORD shutdown
|
||||||
|
|
||||||
|
|
||||||
|
touch /var/lib/mysql/.done
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
service mysql start;
|
|
||||||
mysql -e "CREATE DATABASE IF NOT EXISTS \`${SQL_DATABASE}\`;"
|
|
||||||
mysql -e "CREATE USER IF NOT EXISTS \`${SQL_USER}\`@'localhost' IDENTIFIED BY '${SQL_PASSWORD}';"
|
|
||||||
mysql -e "GRANT ALL PRIVILEGES ON \`${SQL_DATABASE}\`.* TO \`${SQL_USER}\`@'%' IDENTIFIED BY '${SQL_PASSWORD}';"
|
|
||||||
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${SQL_ROOT_PASSWORD}';"
|
|
||||||
mysql -e "FLUSH PRIVILEGES;"
|
|
||||||
mysqladmin -u root -p$SQL_ROOT_PASSWORD shutdown
|
|
||||||
exec mysqld_safe
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
FROM debian:bullseye
|
FROM debian:bullseye
|
||||||
RUN apt update -y
|
|
||||||
RUN apt upgrade -y
|
RUN apt-get update -y && \
|
||||||
RUN apt install nginx -y
|
apt-get upgrade -y && \
|
||||||
RUN apt install openssl -y
|
apt-get install -y nginx openssl && \
|
||||||
RUN mkdir -p /etc/nginx/ssl
|
mkdir -p /etc/nginx/ssl /var/run/nginx && \
|
||||||
RUN mkdir -p /var/run/nginx
|
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
||||||
RUN openssl req -x509 -nodes -out /etc/nginx/ssl/inception.crt -keyout /etc/nginx/ssl/inception.key -subj "/C=FR/ST=IDF/L=Paris/O=42/OU=42/CN=yantoine.42.fr/UID=yantoine"
|
-keyout /etc/ssl/private/server_pkey.pem \
|
||||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
-out /etc/nginx/ssl/server.crt \
|
||||||
RUN chmod 755 /var/www/html
|
-subj "/C=FR/ST=IDF/L=Paris/O=42/OU=42/CN=yantoine.42.fr/UID=yantoine"
|
||||||
RUN chown -R www-data:www-data /var/www/html
|
|
||||||
COPY ./tools/run.sh /run.sh
|
COPY conf/nginx.conf /etc/nginx/sites-available/nginx.conf
|
||||||
RUN chmod +x /run.sh
|
|
||||||
ENTRYPOINT ["/run.sh"]
|
# Suppression du site par défaut et activation de la nouvelle configuration
|
||||||
|
RUN rm /etc/nginx/sites-enabled/default && \
|
||||||
|
ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/
|
||||||
|
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
server {
|
server {
|
||||||
#SSL/TLS Configuration
|
listen 443 ssl default_server;
|
||||||
listen 443 ssl;
|
ssl_certificate /etc/ssl/certs/server.crt;
|
||||||
listen [::]:443 ssl;
|
|
||||||
ssl_protocols TLSv1.3;
|
|
||||||
ssl_certificate /etc/nginx/ssl/inception.crt;
|
|
||||||
ssl_certificate_key /etc/nginx/ssl/inception.key;
|
|
||||||
|
|
||||||
#root and index and server_name
|
ssl_certificate_key /etc/ssl/private/server_pkey.pem;
|
||||||
root /var/www/html;
|
|
||||||
server_name yantoine.42.fr;
|
|
||||||
#index;
|
|
||||||
index index.php
|
|
||||||
|
|
||||||
# Pour toutes les requetes php
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
try_files $uri =404;
|
|
||||||
fastcgi_pass wordpress:9000;
|
|
||||||
include snippets/fastcgi-php.conf;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
server_name $DOMAIN_NAME;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
# Include the fastcgi-php configuration snippet
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
|
||||||
|
# Set the SCRIPT_FILENAME parameter to the full path of the requested script
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
|
||||||
|
|
||||||
|
# Forward requests to the PHP-FPM service listening on the wordpress host on port 9000
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "
|
|
||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
listen [::]:443 ssl;
|
|
||||||
#server_name yantoine.42.fr
|
|
||||||
ssl_certificate /etc/nginx/ssl/inception.crt;
|
|
||||||
ssl_certificate_key /etc/nginx/ssl/inception.key;" > /etc/nginx/sites-available/default
|
|
||||||
|
|
||||||
|
|
||||||
echo '
|
|
||||||
ssl_protocols TLSv1.3;
|
|
||||||
index index.php
|
|
||||||
root /var/www/html;
|
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
try_files $uri =404;
|
|
||||||
fastcgi_pass wordpress:9000;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
}
|
|
||||||
} ' >> /etc/nginx/sites-available/default
|
|
||||||
|
|
||||||
|
|
||||||
nginx -g "daemon off;"
|
|
||||||
Reference in New Issue
Block a user