Skip to content

Instantly share code, notes, and snippets.

@juslintek
Created January 26, 2020 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juslintek/f502c360a0318ab3b37bea9fc82a3467 to your computer and use it in GitHub Desktop.
Save juslintek/f502c360a0318ab3b37bea9fc82a3467 to your computer and use it in GitHub Desktop.
openlitespeed docker
#
# PLAIN TEXT CONFIGURATION FILE
#
#It not set, will use host name as serverName
serverName
user lsadm
group lsadm
priority 0
inMemBufSize 60M
swappingDir /tmp/lshttpd/swap
autoFix503 1
gracefulRestartTimeout 300
mime $SERVER_ROOT/conf/mime.properties
showVersionNumber 0
adminEmails root@localhost
adminRoot $SERVER_ROOT/admin/
errorlog $SERVER_ROOT/logs/error.log {
logLevel DEBUG
debugLevel 0
rollingSize 10M
enableStderrLog 1
}
accesslog $SERVER_ROOT/logs/access.log {
rollingSize 10M
keepDays 30
compressArchive 0
}
indexFiles index.html, index.php
expires {
enableExpires 1
expiresByType image/*=A604800, text/css=A604800, application/x-javascript=A604800
}
tuning {
eventDispatcher best
maxConnections 2000
maxSSLConnections 1000
connTimeout 300
maxKeepAliveReq 1000
smartKeepAlive 0
keepAliveTimeout 5
sndBufSize 0
rcvBufSize 0
maxReqURLLen 8192
maxReqHeaderSize 16380
maxReqBodySize 2047M
maxDynRespHeaderSize 8192
maxDynRespSize 2047M
maxCachedFileSize 4096
totalInMemCacheSize 20M
maxMMapFileSize 256K
totalMMapCacheSize 40M
useSendfile 1
fileETag 28
enableGzipCompress 1
enableDynGzipCompress 1
gzipCompressLevel 6
compressibleTypes text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
gzipAutoUpdateStatic 1
gzipStaticCompressLevel 6
gzipMaxFileSize 1M
gzipMinFileSize 300
SSLCryptoDevice null
}
fileAccessControl {
followSymbolLink 1
checkSymbolLink 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 460M
memHardLimit 470M
procSoftLimit 400
procHardLimit 450
}
accessDenyDir {
dir /
dir /etc/*
dir /dev/*
dir $SERVER_ROOT/conf/*
dir $SERVER_ROOT/admin/conf/*
}
accessControl {
allow ALL
}
extprocessor lsphp {
type lsapi
address uds://tmp/lshttpd/lsphp.sock
maxConns 35
env PHP_LSAPI_MAX_REQUESTS=500
env PHP_LSAPI_CHILDREN=35
initTimeout 60
retryTimeout 0
persistConn 1
respBuffer 0
autoStart 1
path $SERVER_ROOT/fcgi-bin/lsphp
backlog 100
instances 1
priority 0
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 400
procHardLimit 500
}
scripthandler {
add lsapi:lsphp php
}
railsDefaults {
maxConns 5
env LSAPI_MAX_REQS=1000
env LSAPI_MAX_IDLE=60
initTimeout 60
retryTimeout 0
pcKeepAliveTimeout 60
respBuffer 0
backlog 50
runOnStartUp 1
extMaxIdleTime 300
priority 3
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 500
procHardLimit 600
}
module cache {
note Server cache
enableCache 0
enablePrivateCache 0
checkPublicCache 1
checkPrivateCache 1
qsCache 1
reqCookieCache 1
ignoreReqCacheCtrl 1
ignoreRespCacheCtrl 0
respCookieCache 1
expireInSeconds 3600
privateExpireInSeconds 3600
maxStaleAge 200
maxCacheObjSize 10000000
storagepath cachedata
noCacheDomain
noCacheUrl
no-vary 0
addEtag 0
}
virtualhost app {
vhRoot /var/www/app
configFile $SERVER_ROOT/conf/vhosts/app/vhconf.conf
allowSymbolLink 1
enableScript 1
restrained 1
setUIDMode 0
}
listener Default {
address *:8088
secure 0
map app *
}
vhTemplate centralConfigLog {
templateFile $SERVER_ROOT/conf/templates/ccl.conf
listeners Default
}
vhTemplate PHP_SuEXEC {
templateFile $SERVER_ROOT/conf/templates/phpsuexec.conf
listeners Default
}
vhTemplate EasyRailsWithSuEXEC {
templateFile $SERVER_ROOT/conf/templates/rails.conf
listeners Default
}
docRoot $VH_ROOT/public
vhDomain localhost
adminEmails admin@email.tld
enableGzip 1
enableIpGeo 1
errorlog $VH_ROOT/logs/errors.log {
useServer 1
logLevel NOTICE
rollingSize 10M
}
accesslog $VH_ROOT/logs/access.log {
useServer 0
logFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"
logHeaders 7
rollingSize 10M
keepDays 30
compressArchive 1
}
index {
useServer 0
indexFiles index.php
autoIndex 0
}
scripthandler {
add lsapi:lsphp php
}
accessControl {
allow *
}
rewrite {
enable 1
logLevel 9
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
# If the above doesn't work you might need to set the `RewriteBase` directive manually, it should be the
# absolute physical path to the directory that contains this htaccess file.
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
}
module cache {
ls_enabled 1
}
FROM phpearth/php:7.3-litespeed as base
RUN apk add --no-cache composer bash
FROM base as vendor
COPY ./app/composer.json /var/vendor_install/composer.json
RUN cd /var/vendor_install && composer install --prefer-dist --no-interaction
FROM base as config
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Europe/Vilnius /etc/localtime && \
echo "Europe/Vilnius" > /etc/timezone
COPY ./build/docker/config/openlitespeed/httpd_config.conf /etc/litespeed/httpd_config.conf
COPY ./build/docker/config/openlitespeed/vhconf.conf /etc/litespeed/vhosts/app/vhconf.conf
RUN cd /var/lib/litespeed/conf/ && \
chown -R lsadm:lsadm . && \
chmod 644 httpd_config.conf vhosts/app/vhconf.conf
FROM config as common
COPY ./app/ /var/www/app
COPY --from=vendor /var/vendor_install/vendor /var/www/app/vendor
FROM common as prod
RUN cd /var/www/app && composer install --prefer-dist --no-interaction
FROM common as dev
RUN cd /var/www/app && composer install --no-interaction
RUN apk update && apk upgrade && apk add php7.3-dev gcc g++
RUN pecl install xdebug
version: '3.7'
volumes:
logs:
driver: local
db:
services:
database:
container_name: database
image: mysql:latest
ports:
- 3308:3306
environment:
- MYSQL_ROOT_PASSWORD=12345
volumes:
- db:/var/lib/mysql
command: --bind-address=0.0.0.0 --character-set-server=utf8 --collation-server=utf8_general_ci
app:
container_name: app
build:
context: .
dockerfile: build/docker/Dockerfile
image: app:dev
working_dir: /var/www
environment:
docker: "true"
ports:
- 7080:7080
- 8080:8088
volumes:
- ./app:/var/www/app
- logs:/var/www/logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment