Minimal setup of Apache2, MariaDB, PHP, HTTP Proxy, phpMyAdmin, and WordPress.

16 Dec

A detailed setup on how to install Apache, MariaDB, PHP, minimal Apache2 modules to get everything up and running.

This post also details on how to create a non-SSL Apache configuration file, an SSL Apache SSL configuration file, as well as a Proxy Apache configuration file.

Let’s start by updating the repository data and performing a system update:

apt-get update
apt-get upgrade

Next, install OpenSSH server so we can use another computer (copy and paste)

apt-get install openssh-server

A while back, root SSH logins were disabled by default, so we need to enable it:

nano /etc/ssh/sshd_config

Edit line #32:

PermitRootLogin yes

Restart the SSH server to reload the new configuration:

service sshd restart

Now install the required software:

apt-get install net-tools vnstat ntp apache2 php libapache2-mod-php7.0 php-mysql php-mbstring mariadb-server ca-certificates

Complete the MariaDB (replacement for MySQL) installation:

mysql_secure_installation

Create directories which will hold website data:

mkdir -p /var/vhosts/domain-name/www
mkdir -p /var/vhosts/phpmyadmin.domain-name/www

Download the desired version of WordPress and phpMyAdmin:

cd /tmp
wget https://en-ca.wordpress.org/wordpress-4.9.9-en_CA.tar.gz
tar xzf wordpress-4.9.9-en_CA.tar.gz
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-english.tar.gz
tar xzf phpMyAdmin-4.8.4-english.tar.gz

Copy the extracted files to the directories you created:

cd /tmp/wordpress
cp * -R /var/vhosts/domain-name/www
cd /tmp/phpMyAdmin-4.8.4-english
cp * -R /var/vhosts/phpmyadmin.domain-name/www

Create an Apache website configuration file:

nano /etc/apache2/sites-available/domain-name.conf

Add the following to the config file:

<VirtualHost 0.0.0.0:80>
ServerName domain-name

Redirect / https://domain-name/

</VirtualHost>

<VirtualHost *:443>
ServerName domain-name

SSLEngine on

SSLCertificateFile /var/vhosts/domain-name/ssl/domain-name.crt
SSLCertificateKeyFile /var/vhosts/domain-name/ssl/domain-name.key
SSLCertificateChainFile /var/vhosts/domain-name/ssl/ca-cert.crt

DocumentRoot "/var/vhosts/domain-name/www"

<Directory />
AllowOverride All
Require all granted
</Directory>

</VirtualHost>

AllowOverride All instructs Apache to respect the options in the .htaccess file (included with WordPress). If you don’t enable AllowOverride All you will not be able to use RewriteEngine (unless defined elsewhere).

Create another Apache configuration file (phpMyAdmin does not have an .htaccess file):

nano /etc/apache2/sites-available/phpmyadmin.domain-name.conf

Add the config file content:

<VirtualHost 0.0.0.0:443>
ServerName phpmyadmin.domain-name

SSLEngine on

SSLCertificateFile /var/vhosts/domain-name/ssl/domain-name.crt
SSLCertificateKeyFile /var/vhosts/domain-name/ssl/domain-name.key
SSLCertificateChainFile /var/vhosts/domain-name/ssl/ca-cert.crt

DocumentRoot "/var/vhosts/phpmyadmin.domain-name/www"
    
<Directory />
Require all granted
</Directory>

</VirtualHost>

Allow access to phpMyAdmin (you cannot login as root as of MySQL v5.7):

mysql -u root -p

Create a user that can use phpMyAdmin (instead of root):

CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'%' WITH GRANT OPTION;
quit;

Create another directory to hold SSL private key, cert, and chain cert:

mkdir -p /var/vhosts/domain-name/ssl

Add your cert data:

nano /var/vhosts/domain-name/ssl/domain-name.crt
nano /var/vhosts/domain-name/ssl/domain-name.key
nano /var/vhosts/domain-name/ssl/ca-cert.crt

Let’s create an Apache site which will serve as a proxy:

nano /etc/apache2/sites-available/sabnzbdplus.domain-name.conf

Add the config file content:

<VirtualHost 0.0.0.0:80>
ServerName sabnzbdplus.domain-name

Redirect permanent / https://sabnzbdplus.domain-name/

</VirtualHost>

<VirtualHost *:443>
ServerName sabnzbdplus.domain-name

SSLEngine on

SSLCertificateFile /var/vhosts/domain-name/ssl/domain-name.crt
SSLCertificateKeyFile /var/vhosts/domain-name/ssl/domain-name.key
SSLCertificateChainFile /var/vhosts/domain-name/ssl/ca-cert.crt

ProxyPass / http://192.168.24.42:8080/
ProxyPassReverse / http://192.168.24.42:8080/

</VirtualHost>

We’ve been downloading and coping data user the user root, Apache runs as “www-data”, so we need to change the owner on the directories and files which hold web data:

chown -R www-data:www-data /var/vhosts

Enable a few Apache modules:

a2enmod rewrite proxy_http ssl

Simply enable the websites you created:

a2ensite domain-name.conf phpmyadmin.domain-name.conf sabnzbdplus.domain-name.conf

Restart Apache to set everything as active:

systemctl reload apache2

254 thoughts on “Minimal setup of Apache2, MariaDB, PHP, HTTP Proxy, phpMyAdmin, and WordPress.

  1. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  2. Yo, signing up for W88 can be a pain sometimes, but dangkyw88 makes it super easy. Smooth process, highly recommend giving it a shot if you’re looking to join them. Go sign up at dangkyw88!

  3. В мире игр, где всякий ресурс пытается заманить обещаниями легких призов, рейтинг казино интернет
    становится как раз той путеводителем, которая ведет через заросли обмана. Тем ветеранов плюс начинающих, которые надоел с фальшивых посулов, он инструмент, дабы увидеть настоящую выплату, как ощущение выигрышной фишки у пальцах. Минус пустой болтовни, просто проверенные сайты, там rtp не просто число, но реальная везение.Собрано из поисковых запросов, будто ловушка, что захватывает самые актуальные тренды на интернете. Здесь минуя роли про стандартных трюков, каждый элемент будто ставка на столе, где подвох раскрывается мгновенно. Игроки понимают: в стране манера разговора с сарказмом, в котором юмор маскируется как намёк, позволяет избежать обмана.На https://www.youtube.com/@Don8Play/posts этот рейтинг лежит будто раскрытая раздача, приготовленный на старту. Посмотри, если хочешь увидеть пульс настоящей ставки, обходя мифов да провалов. Для тех ценит ощущение приза, такое как держать ставку на ладонях, минуя смотреть в экран.

  4. [6689]Playtime Casino Philippines: Easy Login & Register for Online Slots. Download the Playtime Casino App APK Today! Experience the best online slots at Playtime Casino Philippines! Secure your playtime login, finish your playtime register, and download the playtime casino app APK today for non-stop gaming action and big wins anytime, anywhere. visit: playtime

Leave a Reply

Your email address will not be published.