Docker Install: Difference between revisions

From RAJ INFO
Jump to navigation Jump to search
Line 197: Line 197:


== SSL Apache config ==
== SSL Apache config ==
 
<nowiki>
# SSL horts.in
# SSL horts.in
<VirtualHost *:443>
<VirtualHost *:443>
Line 222: Line 222:


</VirtualHost>
</VirtualHost>
 
</nowiki>
https://www.rajkumar.in/index.php/Main_Page
https://www.rajkumar.in/index.php/Main_Page
https://www.horts.in/index.php/Main_Page
https://www.horts.in/index.php/Main_Page

Revision as of 01:21, 15 September 2025

SERVER CONFIGURATION

DOCKER

docker pull ubuntu:24.04
docker run -it --name web -p 8080:80 -p 21:21 --network idon ubuntu:24.04

IP

docker network connect --ip 172.17.0.10 idon mysql
docker network connect --ip 172.17.0.2 idon web

UPDATE

apt update && upgrade
apt install wget nano curl libpam-modules-bin libpam-modules libpam-runtime libpam0g libsystemd0 libudev1 zip rar htop net-tools imagemagick php-gd python3 cron apache2-utils

Lampp

cd /opt && wget https://excellmedia.dl.sourceforge.net/project/xampp/XAMPP%20Linux/8.2.12/xampp-linux-x64-8.2.12-0-installer.run && chmod 77 xampp-linux-x64-8.2.12-0-installer.run && ./xampp-linux-x64-8.2.12-0-installer.run

change user / group in httpd.conf as www-data

ProFTP

useradd admin
passwd admin
groupadd ftp
usermod -a -G ftp admin
chown root:ftp htdocs
chmod 775 htdocs

Mysql

  • Separate container
  • Assign IP (Refer earlier)
  • > map > mkdir /opt/www -> /volume1/www

Restore

./mysql -u rajplus -p -h localhost ak_wiki </opt/www/backup/mysql/ak_wiki.sql

phpmyadmin

  • Edit /etc/extra/httpd-xampp.conf
Require all granted
  • Access throug web interface and add user and block root
mkdir /opt/save
mkdir /opt/upload
  • Edit Config.inc.php
declare(strict_types=1);
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'rajplus';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['host'] = '172.17.0.7';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['UploadDir'] = '/opt/upload';
$cfg['SaveDir'] = '/opt/save';

APCU

apt install php8.3-dev
pecl channel-update pecl.php.net
pecl install apcu
  • You should add "extension=apcu.so" to php.ini
  • echo "extension=apcu.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

WEB FOLDERS

www

cp -r cp -r /opt/www/backup/www/ /var/ && chown -R www-data:www-data /var/www
  • Crontab : Apache automation
3 * * * * /var/www/tools/apache_service_monitor.py

Mediawiki

cd /var/www/rajkumar && mv root root.old && wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.1.tar.gz && tar xzvf mediawiki-1.43.1.tar.gz && mv mediawiki-1.43.1 root && chown -R www-data:www-data root && cp -r root.old/images root/ && cp -r root.old/extensions/MsUpload root/extensions/ && cp -r root.old/extensions/Iframe root/extensions/ 
  • Web install and configure
  • LocalSettings.php
$wgDBserver = "172.20.0.10";
$wgLocaltimezone = "Asia/Kolkota";
$wgFavicon = "/images/favicon.png";

  • Old Extensions
wfLoadExtension( 'MsUpload' );
wfLoadExtension('Iframe');

$wgMSU_useDragDrop = true; // Should the drag & drop area be shown?
$wgMSU_showAutoCat = true; // Files uploaded while editing a category page will be added to that cat>
$wgMSU_checkAutoCat = true; // Whether the checkbox for adding a category to a page is checked by de>
$wgMSU_useMsLinks = true; // Insert links in Extension:MsLinks style?
$wgMSU_confirmReplace = true; // Show the "Replace file?" checkbox
$wgMSU_imgParams = '400px'; // Default image parameters, for example "thumb|200px"
$wgMSU_uploadsize = '500mb'; // Max upload size through MsUpload

$wgGroupPermissions['user']['upload'] = true; // Allow regular users to upload files
$wgFileExtensions = [ 'png', 'gif', 'jpg', 'jpeg', 'doc' ,'xls', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx', 'pptx' ];
$wgAllowJavaUploads = true;
$wgVerifyMimeType = false;

$wgIframe = array();
$wgIframe['server']['mykey'] = [ 'scheme' => 'https', 'domain' => 'rajkumar.in' ];

require_once("/var/www/.config/global_wiki_config.php");

  • Protecting the Images in Wiki

Add the following code to ../lampp/etc/httpd.conf

<Directory "/var/www/[0-9|a-z]*/root/images">
   AllowOverride None
   AddType text/plain .html .htm .shtml .phtml
   php_admin_flag engine off
   Header set X-Content-Type-Options nosniff
</Directory>


Drupal

apt install composer

cd /var/www/ && rm -fr idon && wget https://ftp.drupal.org/files/projects/drupal-10.5.0.tar.gz && tar xzvf drupal-10.5.0.tar.gz && mv drupal-10.5.0 idon && chown -R www-data:www-data idon && mkdir idon/sites/default/files && chmod 777 idon/sites/default/files && cp idon/sites/default/default.settings.php idon/sites/default/settings.php && chmod 777 idon/sites/default/settings.php

  • opcache
  • Add this to php.ini
[opcache]
zend_extension=opcache.so
openssl.cafile=/opt/lampp/share/curl/curl-ca-bundle.crt

opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=6000
opcache.revalidate_freq=60
opcache.fast_shutdown=1 ; prior to PHP 7.2.0
opcache.enable_cli=1
  • Set up the web interface
chmod 644 idon/sites/default/settings.php

  • Extensions Youtube
apt-get install php-xml
composer require 'drupal/youtube:^2.0'
composer require drupal/video_embed_field

Encrypt MD5

  • Create a file called wp.txt, containing nothing but the new password.
tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘
rm wp.txt

.htaccess

  • Create a .htaccess file
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
  • Create encrypted password
htpasswd -c /var/www/.config/.htpasswd username

SSL Apache config

# SSL horts.in <VirtualHost *:443> ServerAdmin r@rajkumar.in DocumentRoot "/var/www/horts/root" ServerName horts.in ServerAlias www.horts.in SSLEngine on SSLCertificateFile "/opt/lampp/etc/ssl/rajkumar.in.certificate.crt" SSLCertificateKeyFile "/opt/lampp/etc/ssl/rajkumar.in.private.key" SSLCertificateChainFile "/opt/lampp/etc/ssl/rajkumar.in.ca_bundle.crt" ErrorLog "logs/horts.in-error_log" CustomLog "logs/horts.in-access_log" common <Directory "/var/www/horts/root"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Deny,Allow Allow from all Require all granted </Directory> </VirtualHost> https://www.rajkumar.in/index.php/Main_Page https://www.horts.in/index.php/Main_Page