From e66cc37ab376371e5abe099690090494ccc7c7f7 Mon Sep 17 00:00:00 2001 From: HEnull Date: Mon, 13 Mar 2023 00:45:08 +0700 Subject: [PATCH] init projects --- .drone.yml | 44 ++++++++ Dockerfile | 49 +++++++++ httpd_config.conf | 254 ++++++++++++++++++++++++++++++++++++++++++++++ php.ini | 5 + vhconf.conf | 115 +++++++++++++++++++++ 5 files changed, 467 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 httpd_config.conf create mode 100644 php.ini create mode 100644 vhconf.conf diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..02ed739 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,44 @@ +--- +kind: pipeline +type: docker +name: php74 +trigger: + ref: + - refs/tags/php74-* +steps: + - name: docker build + image: plugins/docker + privileged: true + settings: + tags: + - php74 + build_args: + - PHP_VERSION=7.4 + - LSPHP_VERSION=lsphp74 + registry: techio.dev + username: deploy + password: + from_secret: deploy_password + repo: techio.dev/lttech/openlitespeed +--- +kind: pipeline +type: docker +name: php80 +trigger: + ref: + - refs/tags/php80-* +steps: + - name: docker build + image: plugins/docker + privileged: true + settings: + tags: + - php80 + build_args: + - PHP_VERSION=8.0 + - LSPHP_VERSION=lsphp80 + registry: techio.dev + username: deploy + password: + from_secret: deploy_password + repo: techio.dev/lttech/openlitespeed diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eaa52bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +FROM ubuntu:20.04 + +ARG OLS_VERSION=1.7.16 +ARG LSPHP_VERSION=lsphp74 +ARG PHP_VERSION=7.4 +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ Asia/Ho_Chi_Minh + +RUN apt-get update && apt-get install -y --no-install-recommends \ + wget \ + curl \ + ca-certificates \ + cron \ + zip \ + unzip \ + tzdata + +RUN wget --no-check-certificate -O - https://repo.litespeed.sh | bash +RUN apt-get update && apt-get install -y openlitespeed + +RUN apt-get install -y --no-install-recommends \ + mysql-client \ + ${LSPHP_VERSION} \ + ${LSPHP_VERSION}-common \ + ${LSPHP_VERSION}-mysql \ + ${LSPHP_VERSION}-opcache \ + ${LSPHP_VERSION}-curl \ + ${LSPHP_VERSION}-imap \ + ${LSPHP_VERSION}-imagick \ + ${LSPHP_VERSION}-redis \ + ${LSPHP_VERSION}-memcached \ + ${LSPHP_VERSION}-intl \ + #not support php8 + ${LSPHP_VERSION}-json \ + ${LSPHP_VERSION}-ioncube \ + #not support php8 + && rm -rf /var/lib/apt/lists/* + +EXPOSE 8088 + +COPY ./vhconf.conf /usr/local/lsws/conf/vhosts/Example/vhconf.conf +COPY ./php.ini /usr/local/lsws/${LSPHP_VERSION}/etc/php/${PHP_VERSION}/mods-available/php.ini + + +ENV PATH $PATH:/usr/local/lsws/${LSPHP_VERSION}/bin/ + +CMD ["sh", "-c", "/usr/local/lsws/bin/lswsctrl start; tail -F /usr/local/lsws/logs/error.log /usr/local/lsws/logs/access.log"] + +WORKDIR /var/www/html \ No newline at end of file diff --git a/httpd_config.conf b/httpd_config.conf new file mode 100644 index 0000000..dd00f41 --- /dev/null +++ b/httpd_config.conf @@ -0,0 +1,254 @@ +# +# PLAIN TEXT CONFIGURATION FILE +# + +# If not set, will use host name as serverName +serverName +user nobody +group nogroup +priority 0 +autoRestart 1 +chrootPath / +enableChroot 0 +inMemBufSize 60M +swappingDir /tmp/lshttpd/swap +autoFix503 1 +gracefulRestartTimeout 300 +mime conf/mime.properties +showVersionNumber 0 +adminEmails root@localhost +indexFiles index.php, index.html +disableWebAdmin 1 + +errorlog logs/error.log { + logLevel DEBUG + debugLevel 0 + rollingSize 10M + enableStderrLog 1 +} + +accessLog logs/access.log { + rollingSize 10M + keepDays 30 + compressArchive 0 + logReferer 1 + logUserAgent 1 +} + +expires { + enableExpires 1 + expiresByType image/*=A604800,text/css=A604800,application/x-javascript=A604800,application/javascript=A604800,font/*=A604800,application/x-font-ttf=A604800 +} + +tuning { + maxConnections 10000 + maxSSLConnections 10000 + connTimeout 300 + maxKeepAliveReq 10000 + smartKeepAlive 0 + keepAliveTimeout 5 + sndBufSize 0 + rcvBufSize 0 + gzipStaticCompressLevel 6 + gzipMaxFileSize 10M + eventDispatcher best + maxCachedFileSize 4096 + totalInMemCacheSize 20M + maxMMapFileSize 256K + totalMMapCacheSize 40M + useSendfile 1 + fileETag 28 + SSLCryptoDevice null + maxReqURLLen 32768 + maxReqHeaderSize 65536 + maxReqBodySize 2047M + maxDynRespHeaderSize 32768 + maxDynRespSize 2047M + enableGzipCompress 1 + enableBrCompress 4 + enableDynGzipCompress 1 + gzipCompressLevel 6 + brStaticCompressLevel 6 + compressibleTypes default + gzipAutoUpdateStatic 1 + gzipMinFileSize 300 + + quicEnable 1 + quicShmDir /dev/shm + +} + +accessDenyDir { + dir / + dir /etc/* + dir /dev/* + dir conf/* + dir admin/conf/* +} + +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 1460M + memHardLimit 1470M + procSoftLimit 400 + procHardLimit 450 +} + +accessControl { + allow ALL + deny +} + +extProcessor lsphp { + type lsapi + address uds://tmp/lshttpd/lsphp.sock + maxConns 10 + env PHP_LSAPI_CHILDREN=10 + env LSAPI_AVOID_FORK=200M + initTimeout 60 + retryTimeout 0 + persistConn 1 + pcKeepAliveTimeout + respBuffer 0 + autoStart 1 + path lsphp74/bin/lsphp + backlog 100 + instances 1 + priority 0 + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 1400 + procHardLimit 1500 +} + +scriptHandler { + add lsapi:lsphp php +} + +railsDefaults { + binPath + railsEnv 1 + 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 { + binPath + railsEnv 1 + 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 { + binPath + railsEnv 1 + 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 +} + +virtualHost Example { + vhRoot /var/www/ + allowSymbolLink 1 + enableScript 1 + restrained 1 + maxKeepAliveReq + smartKeepAlive + setUIDMode 0 + chrootMode 0 + configFile conf/vhosts/Example/vhconf.conf +} + +listener Default { + address *:8088 + secure 0 + map Example * +} + +vhTemplate centralConfigLog { + templateFile conf/templates/ccl.conf + listeners Default +} + +vhTemplate EasyRailsWithSuEXEC { + templateFile conf/templates/rails.conf + listeners Default +} + +module cache { + ls_enabled 1 + + checkPrivateCache 1 + checkPublicCache 1 + maxCacheObjSize 10000000 + maxStaleAge 200 + qsCache 1 + reqCookieCache 1 + respCookieCache 1 + ignoreReqCacheCtrl 1 + ignoreRespCacheCtrl 0 + + enableCache 0 + expireInSeconds 3600 + enablePrivateCache 0 + privateExpireInSeconds 3600 + +} \ No newline at end of file diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..e93d524 --- /dev/null +++ b/php.ini @@ -0,0 +1,5 @@ +upload_max_filesize = 1024M +post_max_size = 1024M +max_execution_time = 3600 +memory_limit = 512M +max_input_vars = 3000 \ No newline at end of file diff --git a/vhconf.conf b/vhconf.conf new file mode 100644 index 0000000..f8e5ca0 --- /dev/null +++ b/vhconf.conf @@ -0,0 +1,115 @@ +docRoot /var/www/html/ +enableGzip 1 + + +context / { + allowBrowse 1 + location $DOC_ROOT/ + rewrite { + RewriteFile .htaccess + } +} + +context /docs/ { + allowBrowse 1 + location $SERVER_ROOT/docs/ +} + +context /protected/ { + required user test + authName Protected + allowBrowse 1 + location protected/ + realm SampleProtectedArea + + accessControl { + deny + allow * + } +} + +context /blocked/ { + allowBrowse 0 +} + +context /cgi-bin/ { + allowBrowse 1 + location $VH_ROOT/cgi-bin/ + type cgi +} + +expires { + enableExpires 1 +} + +index { + autoIndexURI /_autoindex/default.php + indexFiles index.php, index.html + autoIndex 0 + useServer 0 +} + +errorPage 404 { + url /error404.html +} + +errorlog $SERVER_ROOT/logs/error.log { + logLevel DEBUG + rollingSize 10M + useServer 1 +} + +accessLog $SERVER_ROOT/logs/access.log { + compressArchive 0 + logReferer 1 + keepDays 30 + rollingSize 10M + logUserAgent 1 + useServer 0 +} + +awstats { + updateInterval 86400 + workingDir $VH_ROOT/awstats + updateOffset 0 + siteDomain localhost + siteAliases 127.0.0.1 localhost + updateMode 0 + awstatsURI /awstats/ +} + +rewrite { + enable 0 + logLevel 0 +} + +hotlinkCtrl { + suffixes gif, jpeg, jpg + allowedHosts + allowDirectAccess 1 + enableHotlinkCtrl 0 + onlySelf 1 +} + +accessControl { + deny + allow * +} + +realm SampleProtectedArea { + userDB { + cacheTimeout 60 + maxCacheSize 200 + location conf/vhosts/$VH_NAME/htpasswd + } + + groupDB { + cacheTimeout 60 + maxCacheSize 200 + location conf/vhosts/$VH_NAME/htgroup + } +} + +general { + enableContextAC 0 +} \ No newline at end of file