php 7.4 / php 8;0

This commit is contained in:
luizeof
2022-03-18 06:23:49 -07:00
parent 78ad46be98
commit 0fa623ce6e
11 changed files with 703 additions and 5 deletions
+1 -1
View File
@@ -6,4 +6,4 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
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
5 5 * * * root /usr/local/bin/wpcli-run-media-regenerate
+4 -4
View File
@@ -124,7 +124,7 @@ RUN install_packages \
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
COPY php/opcache.ini /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/opcache.ini
COPY php-7.4/config/opcache.ini /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/opcache.ini
RUN touch /var/www/.opcache
@@ -149,12 +149,12 @@ RUN chown --recursive "lsadm:lsadm" \
# Configure the admin interface
COPY --chown="lsadm:lsadm" \
"litespeed/config/admin_config.conf" \
"php-7.4/litespeed/admin_config.conf" \
"/usr/local/lsws/admin/conf/admin_config.conf"
# Configure the server
COPY --chown="lsadm:lsadm" \
"litespeed/config/httpd_config.conf" \
"php-7.4/litespeed/httpd_config.conf" \
"/usr/local/lsws/conf/httpd_config.conf"
# Create the virtual host folders
@@ -166,7 +166,7 @@ RUN mkdir --parents \
# Configure the virtual host
COPY --chown="lsadm:lsadm" \
"litespeed/config/vhconf.conf" \
"php-7.4/litespeed/vhconf.conf" \
"/usr/local/lsws/conf/vhosts/wordpress/vhconf.conf"
# Set up the virtual host configuration permissions
+235
View File
@@ -0,0 +1,235 @@
FROM bitnami/minideb:buster
LABEL name="DockerPress"
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_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 \
curl \
cron \
less \
sysvbanner \
wget \
nano \
htop \
ghostscript \
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
# Make sure we have required tools
RUN install_packages \
"curl" \
"gnupg"
# Install the Litespeed keys
RUN curl --silent --show-error \
"http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg" |\
apt-key add -
RUN curl --silent --show-error \
"http://rpms.litespeedtech.com/debian/lst_repo.gpg" |\
apt-key add -
# 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 \
"lsphp80"
# Install PHP modules
RUN install_packages \
"lsphp80-apcu" \
"lsphp80-common" \
"lsphp80-curl" \
"lsphp80-igbinary" \
"lsphp80-imagick" \
"lsphp80-imap" \
"lsphp80-intl" \
"lsphp80-ldap" \
"lsphp80-memcached" \
"lsphp80-msgpack" \
"lsphp80-mysql" \
"lsphp80-opcache" \
"lsphp80-pear" \
"lsphp80-pgsql" \
"lsphp80-pspell" \
"lsphp80-redis" \
"lsphp80-sqlite3" \
#"lsphp80-json" \
"lsphp80-tidy"
# Set the default PHP CLI
RUN ln --symbolic --force \
"/usr/local/lsws/lsphp80/bin/lsphp" \
"/usr/local/lsws/fcgi-bin/lsphp5"
RUN ln --symbolic --force \
"/usr/local/lsws/lsphp80/bin/php8.0" \
"/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/lsphp80/etc/php/8.0/litespeed/php.ini
RUN sed -i 's/post_max_size = 8M/post_max_size = 256M/g' /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini
RUN sed -i 's/memory_limit = 128M/memory_limit = 512M/g' /usr/local/lsws/lsphp80/etc/php/8.0/litespeed/php.ini
COPY php-8.0/config/opcache.ini /usr/local/lsws/lsphp80/etc/php/8.0/mods-available/opcache.ini
RUN touch /var/www/.opcache
# 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" \
"php-8.0/litespeed/admin_config.conf" \
"/usr/local/lsws/admin/conf/admin_config.conf"
# Configure the server
COPY --chown="lsadm:lsadm" \
"php-8.0/litespeed/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" \
"php-8.0/litespeed/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/*
# Default Volume for Web
VOLUME /var/www/html
COPY wordpress/.htaccess /var/www
COPY wordpress/wp-config-sample.php /var/www/wp-config-sample.php
# Copy commands
COPY bin/* /usr/local/bin/
# Add Permissions
RUN chmod +x /usr/local/bin/wp
RUN chmod +x /usr/local/bin/mysql-optimize
RUN chmod +x /usr/local/bin/wpcli-run-actionscheduler
RUN chmod +x /usr/local/bin/wpcli-run-clear-scheduler-log
RUN chmod +x /usr/local/bin/wpcli-run-clear-spams
RUN chmod +x /usr/local/bin/wpcli-run-delete-transient
RUN chmod +x /usr/local/bin/wpcli-run-media-regenerate
RUN chmod +x /usr/local/bin/wpcli-run-schedule
# Copy Crontab
COPY cron.d/dockerpress.crontab /etc/cron.d/dockerpress
RUN chmod 644 /etc/cron.d/dockerpress
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
# Set the workdir and command
ENV PATH="/usr/local/lsws/bin:${PATH}"
ENTRYPOINT ["entrypoint.sh"]
+141
View File
@@ -0,0 +1,141 @@
zend_extension=opcache.so;
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1
opcache.jit_buffer_size=
opcache.jit=1255
; The OPcache shared memory storage size.
opcache.memory_consumption=256M
; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=16
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
;If you have multiple PHP sites on the server then consider the value 130986
; for magento 2, keep 65406
opcache.max_accelerated_files=100000
; The maximum percentage of "wasted" memory until a restart is scheduled.
opcache.max_wasted_percentage=15
; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
; files with the same name (basename). Disabling the directive improves
; performance, but may break existing applications.
;opcache.use_cwd=1
; When disabled, you must reset the OPcache manually or restart the
; webserver for changes to the filesystem to take effect.
; For Development / testing, keep 1
; For performance / production, keep 0
opcache.validate_timestamps=0
;opcache.revalidate_freq How often in seconds should the code
;cache expire and check if your code has changed. 0 means it
;checks your PHP code every single request IF YOU HAVE
;opcache.validate_timestamps ENABLED. opcache.validate_timestamps
;should not be enabled by default, as long as it's disabled then any value for opcache.
;revalidate_freq will basically be ignored. You should really only ever enable
;this during development, you don't really want to enable this setting for a production application.
opcache.revalidate_freq=0
; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0
; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
opcache.save_comments=1
; If enabled, a fast shutdown sequence is used for the accelerated code
; Depending on the used Memory Manager this may cause some incompatibilities.
opcache.fast_shutdown=1
; Allow file existence override (file_exists, etc.) performance feature.
opcache.enable_file_override=1
; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
; The location of the OPcache blacklist file (wildcards allowed).
; Each OPcache blacklist file is a text file that holds the names of files
; that should not be accelerated. The file format is to add each filename
; to a new line. The filename may be a full path or just a file prefix
; (i.e., /var/www/x blacklists all the files and directories in /var/www
; that start with 'x'). Line starting with a ; are ignored (comments).
;opcache.blacklist_filename=
; Allows exclusion of large files from being cached. By default all files
; are cached.
; opcache.max_file_size=0
; Check the cache checksum each N requests.
; The default value of "0" means that the checks are disabled.
opcache.consistency_checks=0
; How long to wait (in seconds) for a scheduled restart to begin if the cache
; is not being accessed.
;opcache.force_restart_timeout=180
; OPcache error_log file name. Empty string assumes "stderr".
;opcache.error_log=
; All OPcache errors go to the Web server log.
; By default, only fatal errors (level 0) or errors (level 1) are logged.
; You can also enable warnings (level 2), info messages (level 3) or
; debug messages (level 4).
;opcache.log_verbosity_level=1
; Preferred Shared Memory back-end. Leave empty and let the system decide.
;opcache.preferred_memory_model=
; Protect the shared memory from unexpected writing during script execution.
; Useful for internal debugging only.
;opcache.protect_memory=0
; Allows calling OPcache API functions only from PHP scripts which path is
; started from specified string. The default "" means no restriction
;opcache.restrict_api=
; Mapping base of shared memory segments (for Windows only). All the PHP
; processes have to map shared memory into the same address space. This
; directive allows to manually fix the "Unable to reattach to base address"
; errors.
opcache.mmap_base=0x20000000
; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.
; opcache.file_cache="/var/www/.opcache"
; Enables or disables opcode caching in shared memory.
opcache.file_cache_only=0
; Enables or disables checksum validation when script loaded from file cache.
; opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
; reattach to the shared memory (for Windows only). Explicitly enabled file
; cache is required.
; opcache.file_cache_fallback=1
; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
opcache.huge_code_pages=1
; Validate cached file permissions.
opcache.validate_permission=0
; Prevent name collisions in chroot'ed environment.
; opcache.validate_root=0
+23
View File
@@ -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 1
}
accessControl {
allow ALL
}
listener adminListener {
address *:7080
secure 0
}
+260
View File
@@ -0,0 +1,260 @@
#
# 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-8.0 {
type lsapi
address uds:///tmp/lshttpd/lsphp80.sock
maxConns 25
env PHP_LSAPI_CHILDREN=25
#env LSAPI_AVOID_FORK=200M
env LSAPI_AVOID_FORK=1
initTimeout 60
retryTimeout 0
persistConn 1
respBuffer 0
autoStart 2
path lsphp80/bin/lsphp
backlog 100
instances 1
priority 0
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 1400
procHardLimit 1500
}
scripthandler {
add lsapi:PHP-8.0 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 *
}
+39
View File
@@ -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-8.0 php
}
uploadTmpDir $VH_ROOT/tmp
uploadTmpFilePermission 640
rewrite {
enable 1
autoLoadHtaccess 1
}
context /progress/ {
type module
handler uploadprogress
addDefaultCharset off
}