Tutkimusprosessi: Oletuskonfiguraation ja testausympäristön asennusvaiheet

Huomio:

Tätä konfiguraatiota käytettiin tutkimuksessa, jossa mitattiin kolmen vapaan ohjelmiston HTTP-kiihdyttimen suorituskykyä staattisten ja dynaamisten verkkosivusisältöjen tarjoamisessa.

Konfiguraatio ei ole tarkoitettu sellaisenaan suoraan käyttöönotettavaksi jo olemassa olevaan ympäristöön. Älä siis kopioi huolimattomasti tätä tuotantoon, vaan kokeile ensin testiympäristössä.

Tutkimuksen tarkemmat tiedot löytyvät tästä artikkelista:

Vapaan ohjelmiston HTTP-kiihdyttimien vaikutus verkkosivujen suorituskykyyn (Varnish, Squid, Nginx)


Seuraavat komennot suoritettiin terminaalissa:

sudo apt update
sudo apt upgrade

sudo ufw allow 80/tcp
sudo ufw allow 8080/tcp
sudo ufw enable

sudo apt install apache2
sudo a2enmod userdir
sudo systemctl restart apache2

cd
mkdir public_html
cd public_html
mkdir static
mkdir dynamic

cd /etc/apache2/sites-available/
sudo cp 000-default.conf markus.conf
sudoedit markus.conf

sudo a2dissite 000-default.conf
sudo a2ensite markus.conf
sudo systemctl reload apache2
sudo systemctl restart apache2

sudo apt install php7.2 libapache2-mod-php7.2 php7.2-mysql
sudoedit /etc/apache2/mods-available/php7.2.conf
sudo systemctl restart apache2

sudo apt install php7.2-fpm
sudo a2enmod proxy_fcgi
sudo systemctl restart apache2

cd /etc/php/7.2/fpm/pool.d/
sudo nano markus.conf
sudo systemctl restart php7.2-fpm.service

cd /etc/apache2/sites-available/
sudoedit markus.conf
sudo systemctl restart apache2

sudo apt install mariadb-client mariadb-server
sudo mysql_secure_installation

sudo mariadb -u root -p
SHOW DATABASES;
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO markuswp@localhost IDENTIFIED BY 'password';
exit

wget https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
rm latest.tar.gz
cd wordpress
cp wp-config-sample.php wp-config.php
nano wp-config.php

find /home/markus/public_html/static/ -type d -exec chmod 755 {} \;
find /home/markus/public_html/static/ -type f -exec chmod 644 {} \;
find /home/markus/public_html/dynamic/wordpress/ -type d -exec chmod 755 {} \;
find /home/markus/public_html/dynamic/wordpress/ -type f -exec chmod 644 {} \;

cd /etc/apache2/mods-available/
sudo a2dismod php7.2
sudo a2dismod mpm_prefork
sudo a2enmod mpm_worker
sudo systemctl restart apache2

sudoedit mpm_worker.conf
sudo systemctl restart apache2

Apachen VirtualHost-konfiguraatio /etc/apache2/sites-available/markus.conf:

<VirtualHost *:8080>

    ServerAdmin webmaster@localhost
    DocumentRoot /home/markus/public_html/dynamic/wordpress/
    #DocumentRoot /home/markus/public_html/static/

    <Directory /home/markus/public_html/dynamic/wordpress/>
    #<Directory /home/markus/public_html/static/>
        AllowOverride All
        Require all granted
        Options -Indexes
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php7.2-fpm-markus.sock|fcgi://localhost/"
    </FilesMatch>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Apachen /etc/apache2/ports.conf:

#NameVirtualHost *:8080
Listen 8080

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

Apache-moduulin /etc/apache2/mods-available/mpm_worker.conf määritykset:

<IfModule mpm_worker_module>
    ServerLimit     40
    StartServers             2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestWorkers     1000
    MaxConnectionsPerChild   0
</IfModule>

PHP-FPM konfiguraatio /etc/php/7.2/fpm/pool.d/markus.conf:

[markus]
user = markus
group = markus
listen = /var/run/php/php7.2-fpm-markus.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

TÄTÄ DOKUMENTTIA SAA KOPIOIDA JA MUOKATA GNU GENERAL PUBLIC LICENSE (VERSIO 3 TAI UUDEMPI) MUKAISESTI. HTTP://WWW.GNU.ORG/LICENSES/GPL.HTML
MARKUS PYHÄRANTA

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Scroll to Top