diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0c8074b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# set default line endings to auto +* text=auto +# files that end with .sh should have lf line endings +*.sh text eol=lf +# files that end with .conf should have lf line endings +*.conf text eol=lf + +# dockerfile should have lf line endings +Dockerfile text eol=lf diff --git a/Dockerfile b/Dockerfile index 202cac0..54b2be9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,6 @@ -#FROM wordpress:fpm -FROM wordpress:fpm-alpine +FROM wordpress:6.5.2-php8.1-fpm-alpine -# Pm ondemand to save RAM -RUN sed -i 's/pm = dynamic/pm = ondemand/g' /usr/local/etc/php-fpm.d/www.conf +COPY . /tmp +ENV WORDPRESS_PREPARE_DIR /usr/src/wordpress +RUN chmod 777 /tmp/install.sh && /bin/bash /tmp/install.sh -#RUN apt-get update && apt-get -y install curl unzip -RUN apk add --update curl unzip && rm -Rf /var/cache/apk/* - -# Sqlite integration plugin -RUN curl -o /tmp/wpplugin.zip https://downloads.wordpress.org/plugin/sqlite-integration.1.8.1.zip -RUN unzip /tmp/wpplugin.zip -d /usr/src/wordpress/wp-content/plugins/ -RUN rm /tmp/wpplugin.zip -# Setup -RUN cp /usr/src/wordpress/wp-content/plugins/sqlite-integration/db.php /usr/src/wordpress/wp-content - -COPY config/wp-config.php /var/www/wp-config.php -RUN chown www-data:www-data /var/www/wp-config.php - -VOLUME ["/var/www/db"] diff --git a/config/default.conf b/config/default.conf new file mode 100644 index 0000000..d487dbb --- /dev/null +++ b/config/default.conf @@ -0,0 +1,55 @@ +server { + listen 80; + listen [::]:80; + server_name $host; + index index.php index.html index.htm; + root /var/www/html; + server_tokens off; + client_max_body_size 75M; + + # 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 127.0.0.1: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; + } +} \ No newline at end of file diff --git a/config/wp-config.php b/config/wp-config.php deleted file mode 100755 index 582d758..0000000 --- a/config/wp-config.php +++ /dev/null @@ -1,75 +0,0 @@ -