phpservermon and Debian 9 (Stretch)

23 Jan

Let’s assume Proxmox:

apt-get install qemu-guest-agent openssh-server

Let’s prepare to install a newer version of PHP:

apt -y install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list

Update the sources:

apt-get update

Now we can install:

apt-get install apache2 mysql-server libapache2-mod-php7.4 php7.4-common php7.4-curl php7.4-dev php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip php7.4-mysql postfix

Let’s secure the database server:

mysql_secure_installation

Let’s create a database:

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

I prefer to have the site which runs phpMyAdmin is only accessible on another port:

nano /etc/apache2/ports.conf
Listen 8080

Create the directory the site source code will be located:

mkdir -p /var/vhosts/phpmyadmin/www

Download phpMyAdmin:

cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.7/phpMyAdmin-4.9.7-english.tar.gz
tar xzf phpMyAdmin-4.9.7-english.tar.gz

We can then move it to the created folder:

cd phpMyAdmin-4.9.7-english
cp * -R /var/vhosts/phpmyadmin/www

Update Apache’s configuration:

nano /etc/apache2/sites-available/phpmyadmin.conf
<VirtualHost *:8080>
ServerName phpmyadmin
DocumentRoot "/var/vhosts/phpmyadmin/www"
<Directory />
Require all granted
</Directory>
</VirtualHost>

Assign proper permissions:

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

Enable the site and restart the service:

a2ensite phpmyadmin
service apache2 restart

Create a user and database for phpservermon using phpMyAdmin.

http://ip-address:8080

Let’s create folders, download + extract, and move the source files for phpservermon:

mkdir -p /var/vhosts/website_name/www
mkdir -p /var/vhosts/website_name/ssl
cd /tmp
wget https://github.com/phpservermon/phpservermon/releases/download/v3.5.2/phpservermon-3.5.2.tar.gz
tar xzf phpservermon-3.5.2.tar.gz
cd phpservermon-3.5.2
cp * -R /var/vhosts/website_name/www

Update Apache’s server config:

nano /etc/apache2/sites-available/website_name.conf
<VirtualHost *:80>
ServerName website_name
Redirect / https://website_name/
</VirtualHost>
<VirtualHost *:443>
ServerName website_name
SSLEngine on
SSLCertificateFile /var/vhosts/website_name/ssl/certificate.crt
SSLCertificateKeyFile /var/vhosts/website_name/ssl/key.key
SSLCertificateChainFile /var/vhosts/website_name/ssl/ca-certificate.crt
DocumentRoot "/var/vhosts/website_name/www"
<Directory />
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Create your certificate assets:

nano /var/vhosts/website_name/ssl/key.key
nano /var/vhosts/website_name/ssl/certificate.crt
nano /var/vhosts/website_name/ssl/ca-certificate.crt

Enable the new site and the required SSL module:

a2ensite website_name
a2enmod ssl

Assign the proper owner and restart the service:

chown -R www-data:www-data /var/vhosts
service apache2 restart

41 thoughts on “phpservermon and Debian 9 (Stretch)

  1. I have not checked in here for some time since I thought it was getting boring, but the last several posts are great quality so I guess I¦ll add you back to my daily bloglist. You deserve it my friend 🙂

  2. také jsem si vás poznamenal, abych se podíval na nové věci na vašem blogu.|Hej! Vadilo by vám, kdybych sdílel váš blog s mým facebookem.

  3. You really make it seem really easy together with your presentation however I in finding this matter to be actually something which I think I’d by no means understand. It kind of feels too complex and very broad for me. I’m taking a look forward for your subsequent publish, I?¦ll try to get the cling of it!

  4. I do like the manner in which you have framed this specific situation plus it really does provide me some fodder for thought. Nevertheless, from what I have witnessed, I just simply wish as the actual remarks pile on that individuals remain on point and in no way start on a soap box associated with some other news of the day. Still, thank you for this fantastic point and whilst I can not agree with this in totality, I regard your perspective.

  5. Hey! I could have sworn I’ve been to this website before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely happy I found it and I’ll be bookmarking and checking back often!

  6. Wow, marvelous blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is wonderful, as well as the content!

  7. |Tato stránka má rozhodně všechny informace, které jsem o tomto tématu chtěl a nevěděl jsem, koho se zeptat.|Dobrý den! Tohle je můj 1. komentář tady, takže jsem chtěl jen dát rychlý

Leave a Reply

Your email address will not be published.