Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Reconfigure Docker setup (#59)
Al715bb34ef88c
diff --git a/.gitignore b/.gitignoreindex 3cc82e8..a520093 100755--- a/.gitignore+++ b/.gitignore@@ -3,6 +3,8 @@ storage/cache/*config/db.phpapp/model/*admin/model/*+public/image-cache/*+!public/image-cache/.gitkeeppublic/page-cache/*public/themes/*/*.html!public/themes/*/src/*.htmldiff --git a/Dockerfile b/Dockerfileindex d210d2f..fa07ad7 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,27 +1,12 @@-FROM php:8.2.11-apache+FROM php:8.2-fpm-ARG DOWNLOAD_URL--ENV DIR_VVVEB='/var/www/html'-ENV DIR_CONFIG=${DIR_VVVEB}'/config'-ENV DIR_PUBLIC=${DIR_VVVEB}'/public'-ENV DIR_PLUGINS=${DIR_VVVEB}'/plugins'-ENV DIR_STORAGE=${DIR_VVVEB}'/storage'-ENV DIR_CACHE=${DIR_STORAGE}'/cache'-ENV DIR_DIGITAL_ASSETS=${DIR_STORAGE}'/digital_assets'-ENV DIR_IMAGE_CACHE=${DIR_PUBLIC}'/image-cache'--#change apache document root to public for better security-RUN sed -ri -e 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/*.conf-RUN sed -ri -e 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf--RUN apt-get clean && apt-get update && apt-get install unzip+RUN apt-get clean && apt-get updateRUN apt-get install -y \libfreetype6-dev \libjpeg62-turbo-dev \libxml2-dev \- libwebp-dev \+ libwebp-dev \libpng-dev \libzip-dev \libonig-dev \@@ -32,43 +17,4 @@ RUN apt-get install -y \&& docker-php-ext-install zip\&& docker-php-ext-install mysqli--RUN if [ -z "$DOWNLOAD_URL" ]; then \- curl -Lo /tmp/vvveb.zip https://www.vvveb.com/download.php; \- else \- curl -Lo /tmp/vvveb.zip ${DOWNLOAD_URL}; \- fi--#RUN usermod -u ${PHP_USER_ID} www-data-RUN usermod -u 1000 www-data--RUN unzip /tmp/vvveb.zip -d ${DIR_VVVEB}--RUN rm -rf /tmp/vvveb.zip-COPY php.ini ${PHP_INI_DIR}--RUN a2enmod rewrite-#RUN a2enmod lbmethod_byrequests--WORKDIR ${DIR_VVVEB}--RUN chown -R www-data:www-data ${DIR_VVVEB}-RUN chmod -R 555 ${DIR_VVVEB}-RUN chmod -R 666 ${DIR_STORAGE}-RUN chmod 555 ${DIR_STORAGE}--RUN chmod -R 644 ${DIR_PUBLIC}-RUN chmod 555 ${DIR_PUBLIC}--RUN chmod -R 644 ${DIR_CONFIG}-RUN chmod 555 ${DIR_CONFIG}--RUN chmod -R 666 ${DIR_PLUGINS}-RUN chmod -R 666 ${DIR_CACHE}-RUN chmod -R 666 ${DIR_DIGITAL_ASSETS}-RUN chmod -R 666 ${DIR_IMAGE_CACHE}--EXPOSE 80-#CMD ["apachectl", "-D", "FOREGROUND"]-CMD ["apache2-foreground"]diff --git a/Dockerfile-apache b/Dockerfile-apachenew file mode 100644index 0000000..738cd61--- /dev/null+++ b/Dockerfile-apache@@ -0,0 +1,74 @@+FROM php:8.2.11-apache++ARG DOWNLOAD_URL++ENV DIR_VVVEB='/var/www/html'+ENV DIR_CONFIG=${DIR_VVVEB}'/config'+ENV DIR_PUBLIC=${DIR_VVVEB}'/public'+ENV DIR_PLUGINS=${DIR_VVVEB}'/plugins'+ENV DIR_STORAGE=${DIR_VVVEB}'/storage'+ENV DIR_CACHE=${DIR_STORAGE}'/cache'+ENV DIR_DIGITAL_ASSETS=${DIR_STORAGE}'/digital_assets'+ENV DIR_IMAGE_CACHE=${DIR_PUBLIC}'/image-cache'++#change apache document root to public for better security+RUN sed -ri -e 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/*.conf+RUN sed -ri -e 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf++RUN apt-get clean && apt-get update && apt-get install unzip++RUN apt-get install -y \+ libfreetype6-dev \+ libjpeg62-turbo-dev \+ libxml2-dev \+ libwebp-dev \+ libpng-dev \+ libzip-dev \+ libonig-dev \+ libcurl4-openssl-dev \+ && docker-php-ext-configure gd --with-webp --with-jpeg\+ && docker-php-ext-install -j$(nproc) gd \+ && docker-php-ext-install xml dom curl mbstring intl gettext\+ && docker-php-ext-install zip\+ && docker-php-ext-install mysqli+++RUN if [ -z "$DOWNLOAD_URL" ]; then \+ curl -Lo /tmp/vvveb.zip https://www.vvveb.com/download.php; \+ else \+ curl -Lo /tmp/vvveb.zip ${DOWNLOAD_URL}; \+ fi++#RUN usermod -u ${PHP_USER_ID} www-data+RUN usermod -u 1000 www-data++RUN unzip /tmp/vvveb.zip -d ${DIR_VVVEB}++RUN rm -rf /tmp/vvveb.zip++COPY php.ini ${PHP_INI_DIR}++RUN a2enmod rewrite+#RUN a2enmod lbmethod_byrequests++WORKDIR ${DIR_VVVEB}++RUN chown -R www-data:www-data ${DIR_VVVEB}+RUN chmod -R 555 ${DIR_VVVEB}+RUN chmod -R 666 ${DIR_STORAGE}+RUN chmod 555 ${DIR_STORAGE}++RUN chmod -R 644 ${DIR_PUBLIC}+RUN chmod 555 ${DIR_PUBLIC}++RUN chmod -R 644 ${DIR_CONFIG}+RUN chmod 555 ${DIR_CONFIG}++RUN chmod -R 666 ${DIR_PLUGINS}+RUN chmod -R 666 ${DIR_CACHE}+RUN chmod -R 666 ${DIR_DIGITAL_ASSETS}+RUN chmod -R 666 ${DIR_IMAGE_CACHE}++EXPOSE 80+#CMD ["apachectl", "-D", "FOREGROUND"]+CMD ["apache2-foreground"]diff --git a/docker-compose.yml b/docker-compose-apache.yamlsimilarity index 78%rename from docker-compose.ymlrename to docker-compose-apache.yamlindex 172802f..e8907b7 100755--- a/docker-compose.yml+++ b/docker-compose-apache.yaml@@ -1,11 +1,10 @@-# sudo apt install docker-compose-# sudo docker-compose up -d-version: "3.3"+version: "3.8"+services:vvveb-install:build:context: .- dockerfile: Dockerfile+ dockerfile: Dockerfile-apacherestart: "no"depends_on:- vvveb-app@@ -20,17 +19,23 @@ services:# 'working_dir: /var/www/html# https://docs.vvveb.com/installation#cli add engine=sqlite to cli parameters to install with sqlite- entrypoint: [ "bash", "-c", "sleep 10 && php cli.php install module=index host=db user=vvveb password=vvveb database=vvveb admin[email][email protected] admin[password]=admin"]+ entrypoint:+ [+ "bash",+ "-c",+ "sleep 10 && php cli.php install module=index host=db user=vvveb password=vvveb database=vvveb admin[email][email protected] admin[password]=admin",+ ]# add shared volumevolumes:- vvveb_data:/var/www/html- db_data:/var/lib/mysqlnetworks:- - php-network+ - php-network+vvveb-app:build:context: .- dockerfile: Dockerfile+ dockerfile: Dockerfile-apachecontainer_name: vvveb-cmsports:- "80:80"@@ -43,8 +48,8 @@ services:- vvveb_data:/var/www/html- db_data:/var/lib/mysqlnetworks:- - php-network-+ - php-network+db:image: mysql:latest#command: --default-authentication-plugin=mysql_native_password@@ -55,10 +60,11 @@ services:MYSQL_USER: vvvebMYSQL_PASSWORD: vvvebnetworks:- - php-network+ - php-networkvolumes:- vvveb_data:/var/www/html- db_data:/var/lib/mysql+phpmyadmin:image: phpmyadmin/phpmyadmin:latestcontainer_name: phpmyadmin-cms@@ -73,14 +79,14 @@ services:depends_on:- dbnetworks:- - php-network+ - php-network# volumes:# - db_data:/var/lib/mysql-+volumes:db_data:vvveb_data:networks:- php-network:- driver: bridge+ php-network:+ driver: bridgediff --git a/docker-compose.yaml b/docker-compose.yamlnew file mode 100755index 0000000..6bf8233--- /dev/null+++ b/docker-compose.yaml@@ -0,0 +1,61 @@+version: "3.8"++services:+ db:+ image: mysql:latest+ #command: --default-authentication-plugin=mysql_native_password+ restart: always+ environment:+ MYSQL_ROOT_PASSWORD: vvveb+ MYSQL_DATABASE: vvveb+ MYSQL_USER: vvveb+ MYSQL_PASSWORD: vvveb+ volumes:+ - db:/var/lib/mysql+ networks:+ - internal++ php:+ build:+ context: .+ dockerfile: Dockerfile+ volumes:+ - ./:/var/www/html/+ depends_on:+ - db+ networks:+ - internal++ nginx:+ image: nginx:alpine+ ports:+ - "8080:80"+ volumes:+ - ./:/var/www/html/+ - ./nginx-docker.conf:/etc/nginx/conf.d/default.conf+ depends_on:+ - php+ networks:+ - internal++ phpmyadmin:+ image: phpmyadmin:latest+ ports:+ - "8081:80"+ environment:+ - PMA_ARBITRARY=1+ - PMA_USER=vvveb+ - PMA_PASSWORD=vvveb+ - PMA_HOST=db+ - PMA_PORT=3306+ depends_on:+ - db+ networks:+ - internal++volumes:+ db:++networks:+ internal:+ driver: bridgediff --git a/env.php b/env.phpindex c958b7e..829810f 100755--- a/env.php+++ b/env.php@@ -52,7 +52,7 @@ defined('V_SHARED_SESSION') || define('V_SHARED_SESSION', false);defined('LOG_SQL_QUERIES') || define('LOG_SQL_QUERIES', false);if (DEBUG) {-ini_set('display_errors', 1);-ini_set('display_startup_errors', 1);-error_reporting(E_ALL);+ ini_set('display_errors', 1);+ ini_set('display_startup_errors', 1);+ error_reporting(E_ALL);}diff --git a/index.php b/index.phpindex e3b534a..298ccc1 100755--- a/index.php+++ b/index.php@@ -39,6 +39,9 @@ function is_installed() {return file_exists(DIR_ROOT . 'config' . DS . 'db.php');}+$protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';+$installPathRedirect = "{$protocol}://{$_SERVER['HTTP_HOST']}/install";+if (! defined('APP')) {if (is_installed()) {define('APP', 'app');@@ -47,14 +50,14 @@ if (! defined('APP')) {if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'install') === false) {//avoid redirect loop- die(header('Location: /install'));+ die(header("Location: $installPathRedirect"));}}} elseif (! is_installed() && APP != 'install') {define('APP', 'install');if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'install') === false) {- die(header('Location: /install'));+ die(header("Location: $installPathRedirect"));}}diff --git a/nginx-docker.conf b/nginx-docker.confnew file mode 100644index 0000000..b5b9ac3--- /dev/null+++ b/nginx-docker.conf@@ -0,0 +1,25 @@+server {+ listen 0.0.0.0:80;++ error_log /var/log/nginx/error.log;+ access_log /var/log/nginx/access.log;++ root /var/www/html;++ index index.php index.html;+ error_page 404 /index.php;++ location / {+ try_files $uri $uri/ /index.php?$query_string;+ }++ location ~ \.php$ {+ # try_files $uri =404;++ fastcgi_pass php:9000;+ fastcgi_index index.php;+ fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;+ fastcgi_param PATH_INFO $fastcgi_path_info;+ include fastcgi_params;+ }+}diff --git a/nginx-nocache.conf b/nginx-live-nocache.confsimilarity index 99%rename from nginx-nocache.confrename to nginx-live-nocache.confindex bfde790..eaf0a6c 100755--- a/nginx-nocache.conf+++ b/nginx-live-nocache.conf@@ -19,7 +19,6 @@ server {#ssl_certificate /etc/letsencrypt/live/vvveb.com/fullchain.pem;#ssl_certificate_key /etc/letsencrypt/live/vvveb.com/privkey.pem;-index index.html index.htm index.php;charset utf-8;diff --git a/nginx.conf b/nginx-live.confsimilarity index 68%rename from nginx.confrename to nginx-live.confindex 0696a42..19452a2 100755--- a/nginx.conf+++ b/nginx-live.conf@@ -3,23 +3,23 @@#sudo ln -s /etc/nginx/sites-available/vvveb /etc/nginx/sites-enabled/vvvebupstream php {- server unix:/run/php/php-fpm.sock;- #server 127.0.0.1:9000;+ server unix:/run/php/php-fpm.sock;+ #server 127.0.0.1:9000;}upstream php81 {- server unix:/var/run/php/php8.1-fpm.sock;- #server 127.0.0.1:9000;+ server unix:/var/run/php/php8.1-fpm.sock;+ #server 127.0.0.1:9000;}upstream php82 {- server unix:/var/run/php/php8.2-fpm.sock;- #server 127.0.0.1:9000;+ server unix:/var/run/php/php8.2-fpm.sock;+ #server 127.0.0.1:9000;}upstream php74 {- server unix:/var/run/php/php7.4-fpm.sock;- #server 127.0.0.1:9000;+ server unix:/var/run/php/php7.4-fpm.sock;+ #server 127.0.0.1:9000;}@@ -35,25 +35,25 @@ server {#replace vvveb.net with your domainserver_name *.vvveb.net vvveb.net;- #listen 80 server;- #listen [::]:80 server;- #listen 443 ssl http2;- #listen [::]:443 ssl http2;+ #listen 80 server;+ #listen [::]:80 server;+ #listen 443 ssl http2;+ #listen [::]:443 ssl http2;#ssl_certificate /etc/letsencrypt/live/vvveb.com/fullchain.pem;#ssl_certificate_key /etc/letsencrypt/live/vvveb.com/privkey.pem;- #ssl_session_cache shared:SSL:20m;+ #ssl_session_cache shared:SSL:20m;#ssl_session_timeout 10m;#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;#ssl_prefer_server_ciphers on;#ssl_ciphers 'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5';- #error_log /var/log/nginx/error.log debug;-- #gzip on;- #gzip_vary on;- #gzip_min_length 10240;- #gzip_types text/plain text/css text/xml text/javascript application/x-javascript+ #error_log /var/log/nginx/error.log debug;++ #gzip on;+ #gzip_vary on;+ #gzip_min_length 10240;+ #gzip_types text/plain text/css text/xml text/javascript application/x-javascript#charset utf-8;@@ -68,7 +68,7 @@ server {if ($query_string != "") {set $skip_cache 1;set $cache_uri null;- }+ }# Don't cache uris containing the following segmentsif ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {@@ -96,31 +96,30 @@ server {location ~* "\.(?!php)([\w]{3,4})$" {expires max;log_not_found off;- sendfile on;- sendfile_max_chunk 1m;+ sendfile on;+ sendfile_max_chunk 1m;try_files $uri =404;}location / {- default_type text/html;- try_files /page-cache/$http_host$cache_uri /page-cache/$http_host$cache_uri/index.html $uri $uri/ /index.php?$args;-- #try_files $uri $uri/ /index.php?$args;-- #cache debug- #add_header "uri" $cache_uri;- }+ default_type text/html;+ try_files /page-cache/$http_host$cache_uri /page-cache/$http_host$cache_uri/index.html $uri $uri/ /index.php?$args;++ #try_files $uri $uri/ /index.php?$args;+ #cache debug+ #add_header "uri" $cache_uri;+ }location ~ /media/.+?\.php$ {deny all;}- location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {- expires 30d;- fastcgi_hide_header "Set-Cookie";- }+ location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {+ expires 30d;+ fastcgi_hide_header "Set-Cookie";+ }location ~ \.php$ {#fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;@@ -134,22 +133,22 @@ server {#uncomment fastcgi_cache to enable fastcgi cache, this should not be necessary#unless you set the path to a memory mapped location for even faster cache- #fastcgi_cache VCACHE;+ #fastcgi_cache VCACHE;fastcgi_cache_bypass $skip_cache;fastcgi_no_cache $skip_cache;fastcgi_cache_valid 30m;- #add_header X-VCache $upstream_cache_status;+ #add_header X-VCache $upstream_cache_status;}location = /favicon.ico {- log_not_found off;- access_log off;+ log_not_found off;+ access_log off;}location = /robots.txt {- allow all;- log_not_found off;- access_log off;+ allow all;+ log_not_found off;+ access_log off;}location ~ /\.(?!well-known).* {diff --git a/public/image-cache/.gitkeep b/public/image-cache/.gitkeepnew file mode 100644index 0000000..e69de29