mirror of
https://github.com/luizeof/dockerpress.git
synced 2026-06-19 07:37:10 +00:00
@@ -0,0 +1 @@
|
||||
build.sh
|
||||
+192
-168
@@ -1,205 +1,229 @@
|
||||
FROM php:7.4-apache
|
||||
FROM bitnami/minideb:buster
|
||||
|
||||
LABEL name="DockerPress"
|
||||
LABEL version="2.2.0"
|
||||
LABEL release="2021-10-05"
|
||||
LABEL version="3.0.0"
|
||||
LABEL release="2022-03-07"
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# ENV Defaults
|
||||
ENV WP_CLI_CACHE_DIR "/var/www/.wp-cli/cache/"
|
||||
ENV WP_CLI_PACKAGES_DIR "/var/www/.wp-cli/packages/"
|
||||
ENV ADMIN_EMAIL "webmaster@host.com"
|
||||
ENV WP_POST_REVISIONS true
|
||||
ENV WP_LOCALE "pt_BR"
|
||||
ENV CRON_ACTIONSCHEDULER 1
|
||||
ENV CRON_MEDIA_REGENERATE 1
|
||||
ENV CRON_CLEAR_TRANSIENT 1
|
||||
ENV WP_LOCALE "en_US"
|
||||
ENV WP_DEBUG false
|
||||
ENV WORDPRESS_DB_PORT 3306
|
||||
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE="1"
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
# HTTP port
|
||||
EXPOSE "80/tcp"
|
||||
|
||||
# Webadmin port (HTTPS)
|
||||
EXPOSE "7080/tcp"
|
||||
|
||||
# Install System Libraries
|
||||
RUN apt-get update \
|
||||
&& \
|
||||
apt-get install -y --no-install-recommends \
|
||||
sudo \
|
||||
software-properties-common \
|
||||
build-essential \
|
||||
apache2 \
|
||||
libapache2-mod-security2 \
|
||||
modsecurity-crs \
|
||||
curl \
|
||||
tcl \
|
||||
dos2unix \
|
||||
cron \
|
||||
bzip2 \
|
||||
tidy \
|
||||
sysvbanner \
|
||||
wget \
|
||||
less \
|
||||
nano \
|
||||
htop \
|
||||
zip \
|
||||
unzip \
|
||||
git \
|
||||
libwebp-dev \
|
||||
webp \
|
||||
libwebp6 \
|
||||
graphicsmagick \
|
||||
csstidy \
|
||||
g++ \
|
||||
zlib1g-dev \
|
||||
libjpeg-dev \
|
||||
libmagickwand-dev \
|
||||
libpng-dev \
|
||||
libgif-dev \
|
||||
libtiff-dev \
|
||||
libz-dev \
|
||||
inetutils-ping \
|
||||
libpq-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libaprutil1-dev \
|
||||
libssl-dev \
|
||||
libicu-dev \
|
||||
libldap2-dev \
|
||||
libmemcached-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
mariadb-client \
|
||||
libwebp-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libxpm-dev \
|
||||
libfreetype6-dev \
|
||||
imagemagick \
|
||||
ghostscript \
|
||||
jpegoptim \
|
||||
optipng \
|
||||
pngquant \
|
||||
libc-client-dev \
|
||||
libjpeg-dev \
|
||||
gifsicle \
|
||||
groff \
|
||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& sudo apt-get clean
|
||||
&& \
|
||||
apt-get install -y --no-install-recommends \
|
||||
sudo \
|
||||
curl \
|
||||
cron \
|
||||
sysvbanner \
|
||||
wget \
|
||||
nano \
|
||||
htop \
|
||||
zip \
|
||||
unzip \
|
||||
git \
|
||||
webp \
|
||||
libwebp6 \
|
||||
graphicsmagick \
|
||||
imagemagick \
|
||||
zlib1g \
|
||||
inetutils-ping \
|
||||
libxml2 \
|
||||
default-mysql-client\
|
||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& sudo apt-get clean
|
||||
|
||||
# Configure PHP and System Libraries
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
# Make sure we have required tools
|
||||
RUN install_packages \
|
||||
"curl" \
|
||||
"gnupg"
|
||||
|
||||
RUN docker-php-ext-install -j "$(nproc)" \
|
||||
bcmath \
|
||||
exif \
|
||||
gd \
|
||||
pdo \
|
||||
intl \
|
||||
xml \
|
||||
pdo_mysql \
|
||||
soap \
|
||||
opcache \
|
||||
mysqli \
|
||||
opcache \
|
||||
zip
|
||||
# Install the Litespeed keys
|
||||
RUN curl --silent --show-error \
|
||||
"http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg" |\
|
||||
apt-key add -
|
||||
|
||||
RUN printf "\n" | printf "\n" | pecl install redis \
|
||||
; \
|
||||
pecl install imagick \
|
||||
apcu \
|
||||
memcached
|
||||
RUN curl --silent --show-error \
|
||||
"http://rpms.litespeedtech.com/debian/lst_repo.gpg" |\
|
||||
apt-key add -
|
||||
|
||||
RUN docker-php-ext-enable imagick \
|
||||
bcmath \
|
||||
redis \
|
||||
opcache \
|
||||
apcu \
|
||||
memcached
|
||||
# Install the Litespeed repository
|
||||
RUN \
|
||||
echo "deb http://rpms.litespeedtech.com/debian/ buster main" > "/etc/apt/sources.list.d/openlitespeed.list"
|
||||
|
||||
# Install the Litespeed
|
||||
RUN install_packages \
|
||||
"openlitespeed" && \
|
||||
echo "cloud-docker" > "/usr/local/lsws/PLAT"
|
||||
|
||||
# Install PageSpeed module
|
||||
RUN install_packages \
|
||||
"ols-pagespeed"
|
||||
|
||||
# Install the PHP
|
||||
RUN install_packages \
|
||||
"lsphp74"
|
||||
|
||||
# Install PHP modules
|
||||
RUN install_packages \
|
||||
"lsphp74-apcu" \
|
||||
"lsphp74-common" \
|
||||
"lsphp74-curl" \
|
||||
"lsphp74-igbinary" \
|
||||
"lsphp74-imagick" \
|
||||
"lsphp74-imap" \
|
||||
"lsphp74-intl" \
|
||||
"lsphp74-ldap" \
|
||||
"lsphp74-memcached" \
|
||||
"lsphp74-msgpack" \
|
||||
"lsphp74-mysql" \
|
||||
"lsphp74-opcache" \
|
||||
"lsphp74-pear" \
|
||||
"lsphp74-pgsql" \
|
||||
"lsphp74-pspell" \
|
||||
"lsphp74-redis" \
|
||||
"lsphp74-sqlite3" \
|
||||
"lsphp74-json" \
|
||||
"lsphp74-tidy"
|
||||
|
||||
# Set the default PHP CLI
|
||||
RUN ln --symbolic --force \
|
||||
"/usr/local/lsws/lsphp74/bin/lsphp" \
|
||||
"/usr/local/lsws/fcgi-bin/lsphp5"
|
||||
|
||||
RUN ln --symbolic --force \
|
||||
"/usr/local/lsws/lsphp74/bin/php7.4" \
|
||||
"/usr/bin/php"
|
||||
|
||||
# Install the certificates
|
||||
RUN install_packages \
|
||||
"ca-certificates"
|
||||
|
||||
# Install requirements
|
||||
RUN install_packages \
|
||||
"procps" \
|
||||
"tzdata"
|
||||
|
||||
|
||||
# PHP Settings
|
||||
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 128M/g' /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
|
||||
RUN sed -i 's/post_max_size = 8M/post_max_size = 256M/g' /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=768'; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.max_accelerated_files=99999'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} >>/usr/local/lsws/lsphp74/etc/php/7.4/mods-available/opcache.ini
|
||||
|
||||
# Create the directories
|
||||
RUN mkdir --parents \
|
||||
"/tmp/lshttpd/gzcache" \
|
||||
"/tmp/lshttpd/pagespeed" \
|
||||
"/tmp/lshttpd/stats" \
|
||||
"/tmp/lshttpd/swap" \
|
||||
"/tmp/lshttpd/upload" \
|
||||
"/var/log/litespeed"
|
||||
|
||||
# Make sure logfiles exist
|
||||
RUN touch \
|
||||
"/var/log/litespeed/server.log" \
|
||||
"/var/log/litespeed/access.log"
|
||||
|
||||
# Make sure we have access to files
|
||||
RUN chown --recursive "lsadm:lsadm" \
|
||||
"/tmp/lshttpd" \
|
||||
"/var/log/litespeed"
|
||||
|
||||
# Configure the admin interface
|
||||
COPY --chown="lsadm:lsadm" \
|
||||
"litespeed/config/admin_config.conf" \
|
||||
"/usr/local/lsws/admin/conf/admin_config.conf"
|
||||
|
||||
# Configure the server
|
||||
COPY --chown="lsadm:lsadm" \
|
||||
"litespeed/config/httpd_config.conf" \
|
||||
"/usr/local/lsws/conf/httpd_config.conf"
|
||||
|
||||
# Create the virtual host folders
|
||||
RUN mkdir --parents \
|
||||
"/usr/local/lsws/conf/vhosts/wordpress" \
|
||||
"/var/www" \
|
||||
"/var/www/html" \
|
||||
"/var/www/tmp"
|
||||
|
||||
# Configure the virtual host
|
||||
COPY --chown="lsadm:lsadm" \
|
||||
"litespeed/config/vhconf.conf" \
|
||||
"/usr/local/lsws/conf/vhosts/wordpress/vhconf.conf"
|
||||
|
||||
# Set up the virtual host configuration permissions
|
||||
RUN chown --recursive "lsadm:lsadm" \
|
||||
"/usr/local/lsws/conf/vhosts/wordpress"
|
||||
|
||||
# Set up the virtual host document root permissions
|
||||
RUN chown --recursive "www-data:www-data" \
|
||||
"/var/www/html"
|
||||
|
||||
RUN chown "www-data:www-data" \
|
||||
"/var/www"
|
||||
|
||||
RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set recommended opcache settings
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=768'; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.max_accelerated_files=99999'; \
|
||||
echo 'opcache.revalidate_freq=2'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
RUN { \
|
||||
echo 'file_uploads=On'; \
|
||||
echo 'upload_max_filesize=256M'; \
|
||||
echo 'post_max_size=256M'; \
|
||||
echo 'max_execution_time=300'; \
|
||||
echo 'memory_limit=512M'; \
|
||||
echo 'expose_php=Off'; \
|
||||
} > /usr/local/etc/php/conf.d/php73-recommended.ini
|
||||
|
||||
# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging
|
||||
RUN { \
|
||||
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
|
||||
echo 'display_errors=Off'; \
|
||||
echo 'display_startup_errors=Off'; \
|
||||
echo 'log_errors=On'; \
|
||||
echo 'error_log=/dev/stderr'; \
|
||||
echo 'log_errors_max_len=1024'; \
|
||||
echo 'ignore_repeated_errors=On'; \
|
||||
echo 'ignore_repeated_source=Off'; \
|
||||
echo 'html_errors=Off'; \
|
||||
} > /usr/local/etc/php/conf.d/error-logging.ini
|
||||
|
||||
# Enable apache modules
|
||||
RUN a2enmod setenvif \
|
||||
headers \
|
||||
security2 \
|
||||
deflate \
|
||||
filter \
|
||||
expires \
|
||||
rewrite \
|
||||
include \
|
||||
ext_filter
|
||||
|
||||
# Default Volume for Apache
|
||||
# Default Volume for Web
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Copy Apache Configs
|
||||
COPY apache/conf/dockerpress.conf /etc/apache2/conf-available/dockerpress.conf
|
||||
COPY apache/conf/mozilla-observatory.conf /etc/apache2/conf-available/mozilla-observatory.conf
|
||||
COPY wordpress/.htaccess /var/www
|
||||
|
||||
# Enable Apache Configs
|
||||
RUN a2enconf dockerpress
|
||||
|
||||
# Installing Apache mod-pagespeed
|
||||
RUN curl -o /home/mod-pagespeed-beta_current_amd64.deb https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_amd64.deb
|
||||
RUN dpkg -i /home/mod-pagespeed-*.deb
|
||||
RUN apt-get -f install
|
||||
|
||||
COPY wordpress/.htaccess /var/www/.htaccess-template
|
||||
COPY wordpress/wp-config-sample.php /var/www/wp-config-sample.php
|
||||
|
||||
# Copy commands
|
||||
COPY bin/* /usr/local/bin/
|
||||
|
||||
# Fix Permissions
|
||||
RUN chmod -R +777 /usr/local/bin/
|
||||
|
||||
RUN { \
|
||||
echo '[client]'; \
|
||||
echo 'user=MYUSER'; \
|
||||
echo "password='MYPASSWORD'"; \
|
||||
echo 'host=MYHOST'; \
|
||||
echo 'port=MYPORT'; \
|
||||
echo ''; \
|
||||
echo '[mysql]'; \
|
||||
echo 'database=MYDATABASE'; \
|
||||
echo ''; \
|
||||
} > /root/.my.cnf.sample
|
||||
# Copy Crontab
|
||||
COPY cron.d/dockerpress.crontab /etc/cron.d/dockerpress
|
||||
RUN chmod 644 /etc/cron.d/dockerpress
|
||||
|
||||
# Running container startup scripts
|
||||
RUN { \
|
||||
echo '[client]'; \
|
||||
echo 'user=MYUSER'; \
|
||||
echo "password='MYPASSWORD'"; \
|
||||
echo 'host=MYHOST'; \
|
||||
echo 'port=MYPORT'; \
|
||||
echo ''; \
|
||||
echo '[mysql]'; \
|
||||
echo 'database=MYDATABASE'; \
|
||||
echo ''; \
|
||||
} > /root/.my.cnf.sample
|
||||
|
||||
# Running wordpress startup scripts
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Default Port for Apache
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
# Set the workdir and command
|
||||
ENV PATH="/usr/local/lsws/bin:${PATH}"
|
||||
|
||||
CMD ["apache2-foreground"]
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
@@ -1,26 +1,32 @@
|
||||
# DockerPress
|
||||
|
||||
O DockerPress é uma suíte de serviços que permitem Configurar um Ambiente Docker exclusivo para WordPress com as ferramentas mais poderosas da atualidade.
|
||||
**DockerPress** is a set of services that allows you to configure an exclusive Docker environment for WordPress with the most powerful tools like **OpenliteSpeed**, **Redis**, **Traefik** and **MySQL 8**.
|
||||
|
||||
**Sem acesso ao SSH**, não é necessário conhecimento de infra e funciona nos principais provedores: **Digital Ocean**, **Linode**, **Vultr** e **AWS Lightsail**.
|
||||
The official DockerPress image can be accessed at [https://hub.docker.com/r/luizeof/dockerpress](https://hub.docker.com/r/luizeof/dockerpress).
|
||||
|
||||
- Acompanhe o DockerPress em [https://hub.docker.com/r/luizeof/dockerpress](https://hub.docker.com/r/luizeof/dockerpress).
|
||||
## Environment Variables
|
||||
|
||||
## Variáveis de Ambiente
|
||||
Use the values below to configure your WordPress installation.
|
||||
|
||||
Utilize os valores abaixo para configurar sua instalação do Wordpress.
|
||||
#### Database Settings
|
||||
|
||||
#### Configurações do Mysql
|
||||
| ENV | Padrão | Obrigatório | Descrição |
|
||||
| --- | --- | --- | --- |
|
||||
| WORDPRESS_DB_HOST | | Sim | IP ou Host do MySQL |
|
||||
| WORDPRESS_DB_NAME | | Sim | Nome do Banco de Dados |
|
||||
| WORDPRESS_DB_PASSWORD | | Sim | Senha do MySQL |
|
||||
| WORDPRESS_DB_USER | | Sim | Usuário do MySQL |
|
||||
| ENV | Default | Required | Description |
|
||||
| --------------------- | ------- | -------- | ------------------- |
|
||||
| WORDPRESS_DB_HOST | | Yes | MySQL Host |
|
||||
| WORDPRESS_DB_PORT | 3306 | Yes | MySQL Port |
|
||||
| WORDPRESS_DB_NAME | | Yes | MySQL Database Name |
|
||||
| WORDPRESS_DB_PASSWORD | | Yes | MySQL Password |
|
||||
| WORDPRESS_DB_USER | | Yes | MySQL Username |
|
||||
|
||||
#### Configurações do Redis
|
||||
| ENV | Padrão | Obrigatório | Descrição |
|
||||
| --- | --- | --- | --- |
|
||||
| WP_REDIS_DATABASE | 1 | Não | ID do Banco de Dados Redis |
|
||||
| WP_REDIS_PORT | 6379 | Não | Porta do Servidor Redis |
|
||||
| WP_REDIS_HOST | | Não | IP do Servidor Redis |
|
||||
#### General Settings
|
||||
|
||||
| ENV | Default | Required | Description |
|
||||
| ------------ | ------- | -------- | ------------------------------------------------------------------------------ |
|
||||
| VIRTUAL_HOST | | Yes | Website Domain |
|
||||
| ADMIN_EMAIL | | Yes | Wordpress Admin E-mail |
|
||||
| WP_LOCALE | en_US | No | Wordpress Locale ([Available Locales](https://translate.wordpress.org/stats/)) |
|
||||
| WP_DEBUG | false | No | Enable / Disable Wordpress Debug |
|
||||
|
||||
## Container Volume
|
||||
|
||||
By default, DockerPress uses a single volume that must be mapped to `/var/www/html`. The entire WordPress installation is stored in this path.
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<filesMatch ".(ico|pdf|flv|jpg|svg|jpeg|png|gif|js|css|swf)$">
|
||||
Header set Cache-Control "max-age=8400600, public"
|
||||
</filesMatch>
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
ExpiresByType image/jpg "access 1 year"
|
||||
ExpiresByType image/jpeg "access 1 year"
|
||||
ExpiresByType image/gif "access 1 year"
|
||||
ExpiresByType image/png "access 1 year"
|
||||
ExpiresByType text/css "access 1 month"
|
||||
ExpiresByType application/pdf "access 1 month"
|
||||
ExpiresByType application/javascript "access 1 month"
|
||||
ExpiresByType text/x-javascript "access 1 month"
|
||||
ExpiresByType application/x-javascript "access 1 month"
|
||||
ExpiresByType application/x-shockwave-flash "access 1 month"
|
||||
ExpiresByType image/x-icon "access 1 year"
|
||||
ExpiresByType image/svg "access 1 year"
|
||||
ExpiresByType image/svg+xml "access 1 year"
|
||||
ExpiresDefault "access 1 month"
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/rss+xml
|
||||
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
|
||||
AddOutputFilterByType DEFLATE application/x-font
|
||||
AddOutputFilterByType DEFLATE application/x-font-opentype
|
||||
AddOutputFilterByType DEFLATE application/x-font-otf
|
||||
AddOutputFilterByType DEFLATE application/x-font-truetype
|
||||
AddOutputFilterByType DEFLATE application/x-font-ttf
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE application/xhtml+xml
|
||||
AddOutputFilterByType DEFLATE application/xml
|
||||
AddOutputFilterByType DEFLATE font/opentype
|
||||
AddOutputFilterByType DEFLATE font/otf
|
||||
AddOutputFilterByType DEFLATE font/ttf
|
||||
AddOutputFilterByType DEFLATE image/svg+xml
|
||||
AddOutputFilterByType DEFLATE image/x-icon
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/javascript
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/xml
|
||||
BrowserMatch ^Mozilla/4 gzip-only-text/html
|
||||
BrowserMatch ^Mozilla/4\.0[678] no-gzip
|
||||
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
|
||||
Header append Vary User-Agent
|
||||
</IfModule>
|
||||
|
||||
ServerSignature Off
|
||||
ServerTokens Prod
|
||||
@@ -1,27 +0,0 @@
|
||||
<IfModule mod_headers.c>
|
||||
|
||||
# Pre-existing site that uses too much inline code to fix
|
||||
# but wants to ensure resources are loaded only over https and disable plugins
|
||||
Header set Content-Security-Policy "default-src *; object-src 'none'"
|
||||
|
||||
#This directive will add the CORS header for all resources in the directory from any website.
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
|
||||
# Prevent browsers from incorrectly detecting non-scripts as scripts
|
||||
Header set X-Content-Type-Options "nosniff"
|
||||
|
||||
# Block pages from loading when they detect reflected XSS attacks
|
||||
Header set X-XSS-Protection "1; mode=block"
|
||||
|
||||
# Permissions-Policy header
|
||||
Header set Permissions-Policy "geolocation=(), midi=(), sync-xhr=(), microphone=(), camera=(), magnetometer=(), gyroscope=(), fullscreen=(self), payment=()"
|
||||
|
||||
# X-Frame-Options header
|
||||
Header set X-Frame-Options "SAMEORIGIN"
|
||||
Header set Content-Security-Policy "upgrade-insecure-requests"
|
||||
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
|
||||
|
||||
# Clickjacking protection, using frame-ancestors
|
||||
Header set Content-Security-Policy "frame-ancestors 'self';"
|
||||
|
||||
</IfModule>
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Updating Database Info on wp-config.file "
|
||||
|
||||
wp config set WP_SITEURL "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set WP_HOME "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set DB_NAME $WORDPRESS_DB_NAME --add --type=constant
|
||||
wp config set DB_USER $WORDPRESS_DB_USER --add --type=constant
|
||||
wp config set DB_PASSWORD $WORDPRESS_DB_PASSWORD --add --type=constant
|
||||
wp config set DB_HOST "$WORDPRESS_DB_HOST:$WORDPRESS_DB_PORT" --add --type=constant
|
||||
wp config set DB_PORT $WORDPRESS_DB_PORT --raw --add --type=constant
|
||||
wp config set WP_DEBUG $WP_DEBUG --raw --add --type=constant
|
||||
+1
-1
@@ -16,7 +16,7 @@ if [ -n "$WP_SENTRY_ENV" ]; then
|
||||
fi
|
||||
|
||||
# Configure Sentry Application Version DSN
|
||||
if [ -n "$WP_SENTRY_VERSION" ]; then
|
||||
if [ -n "$WP_SENTRY_VERSION" ]; then
|
||||
wp config set WP_SENTRY_VERSION $WP_SENTRY_VERSION --add --type=constant
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
wp action-scheduler run --path=/var/www/html
|
||||
touch /var/www/wp-scheduler.log
|
||||
|
||||
chown www-data:www-data /var/www/wp-scheduler.log
|
||||
|
||||
wp action-scheduler run --path=/var/www/html >/var/www/wp-scheduler.log
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
wp cron event run --due-now --all --path=/var/www/html
|
||||
touch /var/www/event-scheduler.log
|
||||
|
||||
chown www-data:www-data /var/www/event-scheduler.log
|
||||
|
||||
wp cron event run --due-now --all --path=/var/www/html >/var/www/event-scheduler.log
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -n "$4" ]; then
|
||||
wp eval "wp_mail( '$1', '$2', '<pre>$3</pre>', array('Content-Type: text/html; charset=UTF-8') );" --path=/var/www/html
|
||||
else
|
||||
wp eval "wp_mail( '$1', '$2', '<pre>$3</pre>', array('Content-Type: text/html; charset=UTF-8'), array('$4') );" --path=/var/www/html
|
||||
fi
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
wp vuln status --format=yaml --path=/var/www/html > /var/www/vuln.txt
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
wp eval "wp_mail( 'ADMIN_EMAIL', 'DockerPress: WPVuln Report ' . date('Y-m-d'), 'Your WPVuln Report for VIRTUAL_HOST', '', array('/var/www/vuln.txt') );" --path=/var/www/html
|
||||
@@ -0,0 +1,9 @@
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
* * * * * root /usr/local/bin/wpcli-run-schedule
|
||||
* * * * * root /usr/local/bin/wpcli-run-actionscheduler
|
||||
5 2 * * * root /usr/local/bin/wpcli-run-delete-transient
|
||||
5 3 * * * root /usr/local/bin/wpcli-run-clear-spams
|
||||
5 4 * * * root /usr/local/bin/wpcli-run-clear-scheduler-log
|
||||
5 4 * * * root /usr/local/bin/wpcli-run-media-regenerate
|
||||
+143
-212
@@ -1,109 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Force this for PHP 7.4 compatibility
|
||||
docker-php-ext-enable imagick
|
||||
# remove default index.html if exists
|
||||
rm -f /var/www/html/index.html
|
||||
|
||||
#### Setting Up Env
|
||||
function finish() {
|
||||
/usr/local/lsws/bin/lswsctrl "stop"
|
||||
pkill "tail"
|
||||
}
|
||||
|
||||
touch /var/www/.wp_address
|
||||
touch /var/www/.s3_access_key
|
||||
touch /var/www/.s3_region
|
||||
touch /var/www/.s3_secret_key
|
||||
touch /var/www/.s3_bucket_name
|
||||
touch /var/www/.wp_db_host
|
||||
touch /var/www/.wp_db_user
|
||||
touch /var/www/.wp_db_password
|
||||
touch /var/www/.wp_db_name
|
||||
touch /var/www/.wp_db_preffix
|
||||
touch /var/www/.wp_db_port
|
||||
|
||||
echo $VIRTUAL_HOST >/var/www/.wp_address
|
||||
echo $WORDPRESS_DB_HOST >/var/www/.wp_db_host
|
||||
echo $WORDPRESS_DB_USER >/var/www/.wp_db_user
|
||||
echo $WORDPRESS_DB_PASSWORD >/var/www/.wp_db_password
|
||||
echo $WORDPRESS_DB_NAME >/var/www/.wp_db_name
|
||||
echo $WORDPRESS_DB_PORT >/var/www/.wp_db_port
|
||||
|
||||
#### S3 Backup Settigns
|
||||
|
||||
echo $S3_ACCESS_KEY_ID >/var/www/.s3_access_key
|
||||
echo $AWS_DEFAULT_REGION >/var/www/.s3_region
|
||||
echo $S3_SECRET_ACCESS_KEY >/var/www/.s3_secret_key
|
||||
echo $S3_BUCKET_NAME >/var/www/.s3_bucket_name
|
||||
|
||||
#### Setting Up MySQL Client Defaults
|
||||
|
||||
echo "Updating my.cnf ..."
|
||||
mv /root/.my.cnf.sample /root/.my.cnf
|
||||
sed -i -e "s/MYUSER/$WORDPRESS_DB_USER/g" /root/.my.cnf
|
||||
sed -i -e "s/MYPASSWORD/$WORDPRESS_DB_PASSWORD/g" /root/.my.cnf
|
||||
sed -i -e "s/MYHOST/$WORDPRESS_DB_HOST/g" /root/.my.cnf
|
||||
sed -i -e "s/MYDATABASE/$WORDPRESS_DB_NAME/g" /root/.my.cnf
|
||||
sed -i -e "s/MYPORT/$WORDPRESS_DB_PORT/g" /root/.my.cnf
|
||||
|
||||
#### Setup wp-cli
|
||||
|
||||
echo "Setting up wp-cli..."
|
||||
rm -rf /var/www/.wp-cli/
|
||||
mkdir -p $WP_CLI_CACHE_DIR
|
||||
chown -R www-data:www-data $WP_CLI_CACHE_DIR
|
||||
rm -rf $WP_CLI_PACKAGES_DIR
|
||||
mkdir -p $WP_CLI_PACKAGES_DIR
|
||||
chown -R www-data:www-data $WP_CLI_PACKAGES_DIR
|
||||
rm -f /var/www/wp-cli.phar
|
||||
curl -o /var/www/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
chmod +x /var/www/wp-cli.phar
|
||||
rm -rf /var/www/wp-completion.bash
|
||||
curl -o /var/www/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
|
||||
source /var/www/wp-completion.bash
|
||||
echo "Done"
|
||||
|
||||
### Setting up cron file
|
||||
|
||||
echo "Setting up wp-cron..."
|
||||
touch /etc/cron.d/dockerpress
|
||||
echo "SHELL=/bin/bash" >/etc/cron.d/dockerpress
|
||||
echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >>/etc/cron.d/dockerpress
|
||||
echo "" >>/etc/cron.d/dockerpress
|
||||
|
||||
#### Setting up Mysql Optimize
|
||||
|
||||
echo "Setting up MySL Optimize..."
|
||||
sed -i -e "s/WORDPRESS_DB_HOST/$WORDPRESS_DB_HOST/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_USER/$WORDPRESS_DB_USER/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_PASSWORD/$WORDPRESS_DB_PASSWORD/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_NAME/$WORDPRESS_DB_NAME/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_PORT/$WORDPRESS_DB_PORT/g" /usr/local/bin/mysql-optimize
|
||||
|
||||
#### Creating Wordpress Database using root or another user / password
|
||||
|
||||
if [ -n "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
echo "Try create Database if not exists using root ..."
|
||||
mysql --no-defaults -h $WORDPRESS_DB_HOST --port $WORDPRESS_DB_PORT -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $WORDPRESS_DB_NAME;"
|
||||
else
|
||||
echo "Try create Database if not exists using $WORDPRESS_DB_USER user ..."
|
||||
mysql --no-defaults -h $WORDPRESS_DB_HOST --port $WORDPRESS_DB_PORT -u $WORDPRESS_DB_USER -p$WORDPRESS_DB_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $WORDPRESS_DB_NAME;"
|
||||
fi
|
||||
|
||||
chown -R www-data:www-data /var/www/html/
|
||||
|
||||
if [ ! -e wp-config.php ]; then
|
||||
|
||||
echo "Wordpress not found, downloading latest version ..."
|
||||
|
||||
wp core download --locale=$WP_LOCALE --path=/var/www/html
|
||||
|
||||
echo "Creating wp-config.file ..."
|
||||
|
||||
cp /var/www/wp-config-sample.php /var/www/html/wp-config.php
|
||||
|
||||
chown www-data:www-data /var/www/html/wp-config.php
|
||||
|
||||
echo "Shuffling wp-config.php salts ..."
|
||||
|
||||
wp config shuffle-salts
|
||||
|
||||
echo "Updating Database Info on wp-config.file "
|
||||
function update_wp_config() {
|
||||
echo "Updating wp-config.php ..."
|
||||
wp config set WP_SITEURL "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set WP_HOME "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set DB_NAME $WORDPRESS_DB_NAME --add --type=constant
|
||||
@@ -112,146 +18,171 @@ if [ ! -e wp-config.php ]; then
|
||||
wp config set DB_HOST "$WORDPRESS_DB_HOST:$WORDPRESS_DB_PORT" --add --type=constant
|
||||
wp config set DB_PORT $WORDPRESS_DB_PORT --raw --add --type=constant
|
||||
wp config set WP_DEBUG $WP_DEBUG --raw --add --type=constant
|
||||
}
|
||||
|
||||
# if Wordpress is installed
|
||||
if ! $(wp core is-installed); then
|
||||
echo "Installing Wordpress for $VIRTUAL_HOST ..."
|
||||
wp core install --url=$VIRTUAL_HOST \
|
||||
--title=Wordpress \
|
||||
--admin_user=dockerpress \
|
||||
--admin_password=dockerpress \
|
||||
--admin_email=$ADMIN_EMAIL \
|
||||
--skip-email \
|
||||
--path=/var/www/html
|
||||
function generate_litespeed_password() {
|
||||
if [ -n "${ADMIN_PASSWORD}" ]; then
|
||||
ENCRYPT_PASSWORD="$(/usr/local/lsws/admin/fcgi-bin/admin_php -q '/usr/local/lsws/admin/misc/htpasswd.php' "${ADMIN_PASSWORD}")"
|
||||
echo "admin:${ENCRYPT_PASSWORD}" >'/usr/local/lsws/admin/conf/htpasswd'
|
||||
echo "WebAdmin user/password is admin/${ADMIN_PASSWORD}" >'/usr/local/lsws/adminpasswd'
|
||||
fi
|
||||
}
|
||||
|
||||
# Updating Plugins ...
|
||||
echo "Updating plugins ..."
|
||||
wp plugin update --all
|
||||
function setup_mysql_client() {
|
||||
echo "Updating my.cnf ..."
|
||||
mv /root/.my.cnf.sample /root/.my.cnf
|
||||
sed -i -e "s/MYUSER/$WORDPRESS_DB_USER/g" /root/.my.cnf
|
||||
sed -i -e "s/MYPASSWORD/$WORDPRESS_DB_PASSWORD/g" /root/.my.cnf
|
||||
sed -i -e "s/MYHOST/$WORDPRESS_DB_HOST/g" /root/.my.cnf
|
||||
sed -i -e "s/MYDATABASE/$WORDPRESS_DB_NAME/g" /root/.my.cnf
|
||||
sed -i -e "s/MYPORT/$WORDPRESS_DB_PORT/g" /root/.my.cnf
|
||||
}
|
||||
|
||||
# Remove unused Dolly
|
||||
echo "Remove Dolly..."
|
||||
wp plugin delete hello
|
||||
function install_wp_cli() {
|
||||
echo "Setting up wp-cli..."
|
||||
rm -rf /var/www/.wp-cli/
|
||||
mkdir -p $WP_CLI_CACHE_DIR
|
||||
chown -R www-data:www-data $WP_CLI_CACHE_DIR
|
||||
rm -rf $WP_CLI_PACKAGES_DIR
|
||||
mkdir -p $WP_CLI_PACKAGES_DIR
|
||||
chown -R www-data:www-data $WP_CLI_PACKAGES_DIR
|
||||
rm -f /var/www/wp-cli.phar
|
||||
curl -o /var/www/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
chmod +x /var/www/wp-cli.phar
|
||||
rm -rf /var/www/wp-completion.bash
|
||||
curl -o /var/www/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
|
||||
source /var/www/wp-completion.bash
|
||||
}
|
||||
|
||||
# Updating Themes ...
|
||||
echo "Updating themes ..."
|
||||
wp theme update --all
|
||||
function setup_mysql_optimize() {
|
||||
echo "Setting up MySL Optimize..."
|
||||
sed -i -e "s/WORDPRESS_DB_HOST/$WORDPRESS_DB_HOST/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_USER/$WORDPRESS_DB_USER/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_PASSWORD/$WORDPRESS_DB_PASSWORD/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_NAME/$WORDPRESS_DB_NAME/g" /usr/local/bin/mysql-optimize
|
||||
sed -i -e "s/WORDPRESS_DB_PORT/$WORDPRESS_DB_PORT/g" /usr/local/bin/mysql-optimize
|
||||
}
|
||||
|
||||
echo "Done Installing."
|
||||
function create_wordpress_database() {
|
||||
if [ -n "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
echo "Try create Database if not exists using root ..."
|
||||
mysql --no-defaults -h $WORDPRESS_DB_HOST --port $WORDPRESS_DB_PORT -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $WORDPRESS_DB_NAME;"
|
||||
else
|
||||
echo 'Wordpress is already installed.'
|
||||
echo "Try create Database if not exists using $WORDPRESS_DB_USER user ..."
|
||||
mysql --no-defaults -h $WORDPRESS_DB_HOST --port $WORDPRESS_DB_PORT -u $WORDPRESS_DB_USER -p$WORDPRESS_DB_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $WORDPRESS_DB_NAME;"
|
||||
fi
|
||||
}
|
||||
|
||||
else
|
||||
function install_wordpress() {
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
echo 'wp-config.php file already exists.'
|
||||
if [ ! -e /var/www/html/wp-config.php ]; then
|
||||
|
||||
fi
|
||||
echo "Wordpress not found, downloading latest version ..."
|
||||
wp core download --locale=$WP_LOCALE --path=/var/www/html
|
||||
|
||||
echo "Updating wp-config.php ..."
|
||||
wp config set WP_SITEURL "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set WP_HOME "https://$VIRTUAL_HOST" --add --type=constant
|
||||
wp config set DB_NAME $WORDPRESS_DB_NAME --add --type=constant
|
||||
wp config set DB_USER $WORDPRESS_DB_USER --add --type=constant
|
||||
wp config set DB_PASSWORD $WORDPRESS_DB_PASSWORD --add --type=constant
|
||||
wp config set DB_HOST "$WORDPRESS_DB_HOST:$WORDPRESS_DB_PORT" --add --type=constant
|
||||
wp config set DB_PORT $WORDPRESS_DB_PORT --raw --add --type=constant
|
||||
wp config set WP_DEBUG $WP_DEBUG --raw --add --type=constant
|
||||
echo "Creating wp-config.file ..."
|
||||
cp /var/www/wp-config-sample.php /var/www/html/wp-config.php
|
||||
chown www-data:www-data /var/www/html/wp-config.php
|
||||
update_wp_config
|
||||
|
||||
# Redis Cache
|
||||
if [ -n "$WP_REDIS_HOST" ]; then
|
||||
wp config set WP_CACHE true --raw --add --type=constant
|
||||
wp config set WP_REDIS_HOST $WP_REDIS_HOST --add --type=constant
|
||||
wp config set WP_REDIS_DATABASE $WP_REDIS_DATABASE --raw --add --type=constant
|
||||
wp config set WP_CACHE_KEY_SALT $VIRTUAL_HOST --add --type=constant
|
||||
echo "Shuffling wp-config.php salts ..."
|
||||
wp config shuffle-salts
|
||||
|
||||
if [ -n "$WP_REDIS_PORT" ]; then
|
||||
echo "Setting up redis port..."
|
||||
wp config set WP_REDIS_PORT $WP_REDIS_PORT --raw --add --type=constant
|
||||
fi
|
||||
# if Wordpress is installed
|
||||
if ! $(wp core is-installed); then
|
||||
echo "Installing Wordpress for $VIRTUAL_HOST ..."
|
||||
wp core install --url=$VIRTUAL_HOST \
|
||||
--title=Wordpress \
|
||||
--admin_user=dockerpress \
|
||||
--admin_password=dockerpress \
|
||||
--admin_email=$ADMIN_EMAIL \
|
||||
--skip-email \
|
||||
--path=/var/www/html
|
||||
|
||||
if [ -n "$WP_REDIS_PASSWORD" ]; then
|
||||
echo "Setting up redis password..."
|
||||
wp config set WP_REDIS_PASSWORD $WP_REDIS_PASSWORD --add --type=constant
|
||||
# Updating Plugins ...
|
||||
echo "Updating plugins ..."
|
||||
wp plugin update --all --path=/var/www/html
|
||||
|
||||
# Remove unused Dolly
|
||||
echo "Remove Dolly..."
|
||||
wp plugin delete hello --path=/var/www/html
|
||||
|
||||
# Updating Themes ...
|
||||
echo "Updating themes ..."
|
||||
wp theme update --all --path=/var/www/html
|
||||
|
||||
echo "Done Installing."
|
||||
else
|
||||
echo 'Wordpress is already installed.'
|
||||
fi
|
||||
else
|
||||
echo "Redis password not set. Try to create a more secure redis setup."
|
||||
echo 'wp-config.php file already exists.'
|
||||
update_wp_config
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable Cloudflare Plugin
|
||||
if [ -n "$WP_CLOUDFLARE_HTTP2" ]; then
|
||||
echo "Enable the Cloudflare HTTTP2..."
|
||||
wp config set CLOUDFLARE_HTTP2_SERVER_PUSH_ACTIVE true --raw --add --type=constant
|
||||
wp plugin install cloudflare --force
|
||||
fi
|
||||
function install_dockerpress_plugins() {
|
||||
echo "Installing action-scheduler ..."
|
||||
wp plugin install action-scheduler --force --activate --path=/var/www/html
|
||||
|
||||
echo "wp-config.php updated."
|
||||
echo "Installing litespeed-cache ..."
|
||||
wp plugin install litespeed-cache --force --activate --path=/var/www/html
|
||||
|
||||
echo "Installing action-scheduler ..."
|
||||
wp plugin install action-scheduler --force --activate
|
||||
echo "Installing regenerate-thumbnails ..."
|
||||
wp plugin install regenerate-thumbnails --force --activate --path=/var/www/html
|
||||
}
|
||||
|
||||
# Setting up wp-profile -> https://github.com/wp-cli/profile-command
|
||||
wp package install git@github.com:wp-cli/profile-command.git
|
||||
cd /var/www/html
|
||||
|
||||
echo "CRON: Enabling Action Scheduler ..."
|
||||
echo '*/2 * * * * root /usr/local/bin/wpcli-run-schedule ' >>/etc/cron.d/dockerpress
|
||||
echo '*/3 * * * * root /usr/local/bin/wpcli-run-actionscheduler ' >>/etc/cron.d/dockerpress
|
||||
# Generate litespeed Admin Password
|
||||
generate_litespeed_password
|
||||
|
||||
if [ ! -e /var/www/html/.htaccess ]; then
|
||||
echo ".htaccess not found, copying now ..."
|
||||
cp -f /var/www/.htaccess-template /var/www/html/.htaccess
|
||||
chown www-data:www-data /var/www/html/.htaccess
|
||||
fi
|
||||
trap cleanup SIGTERM
|
||||
|
||||
# Redis Cache
|
||||
if [ -n "$WP_REDIS_HOST" ]; then
|
||||
echo "Enabling Redis Cache ..."
|
||||
rm -f /var/www/html/wp-content/object-cache.php
|
||||
wp plugin install redis-cache --force --activate
|
||||
wp redis update-dropin
|
||||
wp redis enable
|
||||
chmod +777 /var/www/html/wp-content/object-cache.php
|
||||
fi
|
||||
#### Setting Up MySQL Client Defaults
|
||||
setup_mysql_client
|
||||
|
||||
# Enabling WPVULN Daily Report
|
||||
if [ -n "$VULN_API_TOKEN" ]; then
|
||||
echo "Enabling VULN Daily report ..."
|
||||
sed -i -e "s/ADMIN_EMAIL/$ADMIN_EMAIL/g" /usr/local/bin/wpcli-run-vuln-send-report
|
||||
sed -i -e "s/VIRTUAL_HOST/$VIRTUAL_HOST/g" /usr/local/bin/wpcli-run-vuln-send-report
|
||||
wp package install git@github.com:10up/wp-vulnerability-scanner.git
|
||||
wp config set VULN_API_TOKEN $VULN_API_TOKEN --add --type=constant
|
||||
echo '4 25 * * * root wpcli-run-vuln-generate' >>/etc/cron.d/dockerpress
|
||||
echo '5 45 * * * root wpcli-run-vuln-send-report' >>/etc/cron.d/dockerpress
|
||||
fi
|
||||
|
||||
if [ "$CRON_MEDIA_REGENERATE" -eq 1 ]; then
|
||||
echo "CRON: Enabling Media Regenerate ..."
|
||||
echo '1 0 * * * root /usr/local/bin/wpcli-run-media-regenerate' >>/etc/cron.d/dockerpress
|
||||
wp plugin install regenerate-thumbnails --force --activate
|
||||
fi
|
||||
|
||||
if [ "$CRON_CLEAR_TRANSIENT" -eq 1 ]; then
|
||||
echo "CRON: Enabling Clear Transients ..."
|
||||
echo '30 2 * * * root /usr/local/bin/wpcli-run-delete-transient' >>/etc/cron.d/dockerpress
|
||||
fi
|
||||
|
||||
echo '' >>/etc/cron.d/dockerpress
|
||||
|
||||
dos2unix /etc/cron.d/dockerpress
|
||||
|
||||
chmod 644 /etc/cron.d/dockerpress
|
||||
|
||||
if [ -n "$ENABLE_MOZILLA_OBSERVATORY" ]; then
|
||||
a2enconf mozilla-observatory
|
||||
fi
|
||||
|
||||
service apache2 reload
|
||||
#### Setup wp-cli
|
||||
install_wp_cli
|
||||
|
||||
### setting up cron service
|
||||
service cron reload
|
||||
service cron start
|
||||
|
||||
chown -R www-data:www-data /var/www/html/
|
||||
#### Setting up Mysql Optimize
|
||||
setup_mysql_optimize
|
||||
|
||||
#### Creating Wordpress Database
|
||||
create_wordpress_database
|
||||
|
||||
# run wordpress installer
|
||||
install_wordpress
|
||||
|
||||
# install and activate default plugins
|
||||
install_dockerpress_plugins
|
||||
|
||||
# update file permissions
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
wp core verify-checksums
|
||||
|
||||
if [ ! -e /var/www/html/.htaccess ]; then
|
||||
cp /var/www/.htaccess /var/www/html
|
||||
chown -R www-data:www-data /var/www/html/.htaccess
|
||||
fi
|
||||
|
||||
# Start the LiteSpeed
|
||||
/usr/local/lsws/bin/litespeed
|
||||
|
||||
# welcome to dockerpress
|
||||
sysvbanner dockerpress
|
||||
|
||||
# Read the credentials
|
||||
cat '/usr/local/lsws/adminpasswd'
|
||||
|
||||
# Tail the logs to stdout
|
||||
tail -f \
|
||||
'/var/log/litespeed/access.log'
|
||||
|
||||
exec "$@"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
enableCoreDump 0
|
||||
sessionTimeout 3600
|
||||
|
||||
errorlog /var/log/litespeed/admin-error.log {
|
||||
useServer 1
|
||||
logLevel INFO
|
||||
rollingSize 10M
|
||||
}
|
||||
|
||||
accesslog /var/log/litespeed/admin-access.log {
|
||||
useServer 1
|
||||
rollingSize 10M
|
||||
keepDays 90
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
listener adminListener {
|
||||
address *:7080
|
||||
secure 0
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
#
|
||||
# PLAIN TEXT CONFIGURATION FILE
|
||||
#
|
||||
|
||||
#It not set, will use host name as serverName
|
||||
user nobody
|
||||
group nogroup
|
||||
priority 0
|
||||
cpuAffinity 0
|
||||
enableLVE 0
|
||||
inMemBufSize 96M
|
||||
swappingDir /tmp/lshttpd/swap
|
||||
autoFix503 1
|
||||
enableh2c 1
|
||||
gracefulRestartTimeout 300
|
||||
statDir /tmp/lshttpd/stats
|
||||
mime conf/mime.properties
|
||||
disableInitLogRotation 1
|
||||
showVersionNumber 0
|
||||
enableIpGeo 0
|
||||
useIpInProxyHeader 3
|
||||
adminEmails root@localhost
|
||||
|
||||
errorlog /var/log/litespeed/server.log {
|
||||
logLevel NOTICE
|
||||
debugLevel 0
|
||||
rollingSize 10M
|
||||
enableStderrLog 1
|
||||
}
|
||||
|
||||
accesslog /var/log/litespeed/access.log {
|
||||
rollingSize 10M
|
||||
keepDays 1
|
||||
compressArchive 0
|
||||
}
|
||||
indexFiles index.html, index.php
|
||||
autoIndex 0
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
expiresByType image/*=A604800,text/css=A604800,application/x-javascript=A604800,application/javascript=A604800,font/*=A604800,application/x-font-ttf=A604800
|
||||
}
|
||||
autoLoadHtaccess 1
|
||||
uploadTmpDir /tmp/lshttpd/upload
|
||||
uploadTmpFilePermission 640
|
||||
|
||||
tuning {
|
||||
shmDefaultDir /dev/shm
|
||||
maxConnections 10000
|
||||
maxSSLConnections 10000
|
||||
connTimeout 300
|
||||
maxKeepAliveReq 10000
|
||||
keepAliveTimeout 5
|
||||
sndBufSize 0
|
||||
rcvBufSize 0
|
||||
maxReqURLLen 32768
|
||||
maxReqHeaderSize 65536
|
||||
maxReqBodySize 2047M
|
||||
maxDynRespHeaderSize 32768
|
||||
maxDynRespSize 2047M
|
||||
maxCachedFileSize 4096
|
||||
totalInMemCacheSize 512M
|
||||
maxMMapFileSize 256K
|
||||
totalMMapCacheSize 512M
|
||||
useSendfile 1
|
||||
fileETag 28
|
||||
enableGzipCompress 1
|
||||
compressibleTypes text/*, application/x-javascript, application/xml, application/javascript, image/svg+xml, application/rss+xml
|
||||
enableDynGzipCompress 1
|
||||
gzipCompressLevel 6
|
||||
gzipAutoUpdateStatic 1
|
||||
gzipStaticCompressLevel 6
|
||||
brStaticCompressLevel 6
|
||||
gzipCacheDir /tmp/lshttpd/gzcache
|
||||
gzipMaxFileSize 60M
|
||||
gzipMinFileSize 100
|
||||
sslStrongDhKey 1
|
||||
sslEnableMultiCerts 1
|
||||
sslSessionCache 1
|
||||
sslSessionCacheSize 1000000
|
||||
sslSessionCacheTimeout 3600
|
||||
sslSessionTickets 1
|
||||
sslSessionTicketLifetime 216000
|
||||
quicEnable 1
|
||||
quicShmDir /dev/shm
|
||||
quicCfcw 2M
|
||||
quicSfcw 1M
|
||||
quicMaxStreams 100
|
||||
quicHandshakeTimeout 10
|
||||
quicIdleTimeout 30
|
||||
}
|
||||
|
||||
fileAccessControl {
|
||||
followSymbolLink 1
|
||||
checkSymbolLink 0
|
||||
forceStrictOwnership 0
|
||||
requiredPermissionMask 000
|
||||
restrictedPermissionMask 000
|
||||
}
|
||||
|
||||
perClientConnLimit {
|
||||
staticReqPerSec 0
|
||||
dynReqPerSec 0
|
||||
outBandwidth 0
|
||||
inBandwidth 0
|
||||
softLimit 10000
|
||||
hardLimit 10000
|
||||
gracePeriod 15
|
||||
banPeriod 300
|
||||
}
|
||||
|
||||
CGIRLimit {
|
||||
maxCGIInstances 20
|
||||
minUID 11
|
||||
minGID 10
|
||||
priority 0
|
||||
CPUSoftLimit 10
|
||||
CPUHardLimit 50
|
||||
memSoftLimit 1460M
|
||||
memHardLimit 1470M
|
||||
procSoftLimit 400
|
||||
procHardLimit 450
|
||||
}
|
||||
|
||||
accessDenyDir {
|
||||
dir /
|
||||
dir /etc/*
|
||||
dir /dev/*
|
||||
dir conf/*
|
||||
dir admin/conf/*
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
extprocessor PHP-7.4 {
|
||||
type lsapi
|
||||
address uds:///tmp/lshttpd/lsphp74.sock
|
||||
maxConns 25
|
||||
env PHP_LSAPI_CHILDREN=25
|
||||
env LSAPI_AVOID_FORK=200M
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
persistConn 1
|
||||
respBuffer 0
|
||||
autoStart 2
|
||||
path lsphp74/bin/lsphp
|
||||
backlog 100
|
||||
instances 1
|
||||
priority 0
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 1400
|
||||
procHardLimit 1500
|
||||
}
|
||||
|
||||
scripthandler {
|
||||
add lsapi:PHP-7.4 php
|
||||
}
|
||||
|
||||
railsDefaults {
|
||||
maxConns 1
|
||||
env LSAPI_MAX_IDLE=60
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
pcKeepAliveTimeout 60
|
||||
respBuffer 0
|
||||
backlog 50
|
||||
runOnStartUp 3
|
||||
extMaxIdleTime 300
|
||||
priority 3
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 500
|
||||
procHardLimit 600
|
||||
}
|
||||
|
||||
wsgiDefaults {
|
||||
maxConns 5
|
||||
env LSAPI_MAX_IDLE=60
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
pcKeepAliveTimeout 60
|
||||
respBuffer 0
|
||||
backlog 50
|
||||
runOnStartUp 3
|
||||
extMaxIdleTime 300
|
||||
priority 3
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 500
|
||||
procHardLimit 600
|
||||
}
|
||||
|
||||
nodeDefaults {
|
||||
maxConns 5
|
||||
env LSAPI_MAX_IDLE=60
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
pcKeepAliveTimeout 60
|
||||
respBuffer 0
|
||||
backlog 50
|
||||
runOnStartUp 3
|
||||
extMaxIdleTime 300
|
||||
priority 3
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 500
|
||||
procHardLimit 600
|
||||
}
|
||||
|
||||
module uploadprogress {
|
||||
ls_enabled 1
|
||||
}
|
||||
|
||||
module cache {
|
||||
internal 1
|
||||
|
||||
checkPrivateCache 1
|
||||
checkPublicCache 1
|
||||
maxCacheObjSize 10000000
|
||||
maxStaleAge 200
|
||||
qsCache 1
|
||||
reqCookieCache 1
|
||||
respCookieCache 1
|
||||
ignoreReqCacheCtrl 1
|
||||
ignoreRespCacheCtrl 0
|
||||
|
||||
enableCache 1
|
||||
expireInSeconds 3600
|
||||
enablePrivateCache 1
|
||||
privateExpireInSeconds 3600
|
||||
ls_enabled 1
|
||||
}
|
||||
|
||||
module modpagespeed {
|
||||
pagespeed off
|
||||
pagespeed FileCachePath /tmp/lshttpd/pagespeed
|
||||
pagespeed RewriteLevel CoreFilters
|
||||
ls_enabled 0
|
||||
}
|
||||
|
||||
virtualhost wordpress {
|
||||
vhRoot /var/www/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
allowSymbolLink 1
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
user www-data
|
||||
group www-data
|
||||
}
|
||||
|
||||
listener HTTP {
|
||||
address *:80
|
||||
secure 0
|
||||
map wordpress *
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
docRoot $VH_ROOT/html
|
||||
adminEmails root@localhost
|
||||
enableGzip 1
|
||||
enableIpGeo 1
|
||||
cgroups 0
|
||||
|
||||
errorlog /var/log/litespeed/wordpress-error.log {
|
||||
useServer 1
|
||||
logLevel INFO
|
||||
rollingSize 1M
|
||||
}
|
||||
|
||||
accesslog /var/log/litespeed/wordpress-access.log {
|
||||
useServer 1
|
||||
rollingSize 1M
|
||||
keepDays 1
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 1
|
||||
autoIndex 0
|
||||
}
|
||||
|
||||
scripthandler {
|
||||
add lsapi:PHP-7.4 php
|
||||
}
|
||||
uploadTmpDir $VH_ROOT/tmp
|
||||
uploadTmpFilePermission 640
|
||||
|
||||
rewrite {
|
||||
enable 1
|
||||
autoLoadHtaccess 1
|
||||
}
|
||||
|
||||
context /progress/ {
|
||||
type module
|
||||
handler uploadprogress
|
||||
addDefaultCharset off
|
||||
}
|
||||
+40
-1
@@ -1,10 +1,49 @@
|
||||
# BEGIN LSCACHE
|
||||
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
|
||||
<IfModule LiteSpeed>
|
||||
RewriteEngine on
|
||||
CacheLookup on
|
||||
RewriteRule .* - [E=Cache-Control:no-autoflush]
|
||||
RewriteRule \.litespeed_conf\.dat - [F,L]
|
||||
|
||||
### marker CACHE RESOURCE start ###
|
||||
RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
|
||||
### marker CACHE RESOURCE end ###
|
||||
|
||||
### marker LOGIN COOKIE start ###
|
||||
RewriteRule .? - [E="Cache-Vary:,wp-postpass_b4b5e544a3d3f9ba5565c1a7b9abdd83"]
|
||||
### marker LOGIN COOKIE end ###
|
||||
|
||||
### marker FAVICON start ###
|
||||
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
|
||||
### marker FAVICON end ###
|
||||
|
||||
### marker DROPQS start ###
|
||||
CacheKeyModify -qs:fbclid
|
||||
CacheKeyModify -qs:gclid
|
||||
CacheKeyModify -qs:utm*
|
||||
CacheKeyModify -qs:_ga
|
||||
### marker DROPQS end ###
|
||||
|
||||
</IfModule>
|
||||
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
|
||||
# END LSCACHE
|
||||
# BEGIN NON_LSCACHE
|
||||
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
|
||||
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
|
||||
# END NON_LSCACHE
|
||||
# BEGIN WordPress
|
||||
# As diretrizes (linhas) entre "BEGIN WordPress" e "END WordPress" são
|
||||
# geradas dinamicamente e só devem ser modificadas através de filtros do WordPress.
|
||||
# Quaisquer alterações nas diretivas entre esses marcadores serão sobrescritas.
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
</IfModule>
|
||||
# END WordPress
|
||||
|
||||
# END WordPress
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The base configuration for WordPress
|
||||
*
|
||||
@@ -20,22 +21,22 @@
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define( 'DB_NAME', 'database_name_here' );
|
||||
define('DB_NAME', 'database_name_here');
|
||||
|
||||
/** MySQL database username */
|
||||
define( 'DB_USER', 'username_here' );
|
||||
define('DB_USER', 'username_here');
|
||||
|
||||
/** MySQL database password */
|
||||
define( 'DB_PASSWORD', 'password_here' );
|
||||
define('DB_PASSWORD', 'password_here');
|
||||
|
||||
/** MySQL hostname */
|
||||
define( 'DB_HOST', 'localhost' );
|
||||
define('DB_HOST', 'localhost');
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', 'utf8mb4' );
|
||||
define('DB_CHARSET', 'utf8mb4');
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', '' );
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
/**
|
||||
* Authentication Unique Keys and Salts.
|
||||
@@ -46,14 +47,14 @@ define( 'DB_COLLATE', '' );
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
define( 'AUTH_KEY', 'put your unique phrase here' );
|
||||
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
|
||||
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
|
||||
define( 'NONCE_KEY', 'put your unique phrase here' );
|
||||
define( 'AUTH_SALT', 'put your unique phrase here' );
|
||||
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
|
||||
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
|
||||
define( 'NONCE_SALT', 'put your unique phrase here' );
|
||||
define('AUTH_KEY', 'put your unique phrase here');
|
||||
define('SECURE_AUTH_KEY', 'put your unique phrase here');
|
||||
define('LOGGED_IN_KEY', 'put your unique phrase here');
|
||||
define('NONCE_KEY', 'put your unique phrase here');
|
||||
define('AUTH_SALT', 'put your unique phrase here');
|
||||
define('SECURE_AUTH_SALT', 'put your unique phrase here');
|
||||
define('LOGGED_IN_SALT', 'put your unique phrase here');
|
||||
define('NONCE_SALT', 'put your unique phrase here');
|
||||
|
||||
/**
|
||||
* WordPress Database Table prefix.
|
||||
@@ -76,21 +77,21 @@ $table_prefix = 'wp_';
|
||||
* @link https://codex.wordpress.org/Debugging_in_WordPress
|
||||
*/
|
||||
|
||||
define( 'WP_DEBUG', false );
|
||||
define('WP_DEBUG', false);
|
||||
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|
||||
if (isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|
||||
$_SERVER['HTTPS'] = '1';
|
||||
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
if (isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) && isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
}
|
||||
|
||||
/* That's all, stop editing! Happy publishing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
|
||||
if (!defined('ABSPATH')) {
|
||||
define('ABSPATH', dirname(__FILE__) . '/');
|
||||
}
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once( ABSPATH . 'wp-settings.php' );
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
||||
|
||||
Reference in New Issue
Block a user