Setting up a hosting environment with Froxlor on Gentoo

In the webhosting environment I will use Nginx, PHP 5.5 FPM and MariaDB. For customer management Froxlor will be used.
To successfully set up our hosting environment on Gentoo, we need to install a few packages beforehand. Afterwards we will use the configuration files provided by froxlor.

USE Flags

Before the packages for the base hosting environment are emerged the use flags should be set. I added a directory called package.use in /etc/portage and placed a file called hosting_environment there. This has the advantage to that everything concerning the hosting can be placed in this file. Be sure to modify these use flags to your needs!

Emerge packages

Run the following command and check the output if it fits your needs. Then get coffee.

emerge -av nginx php mariadb libnss-mysql unscd

Database (MariaDB)

As database I decided to use MariaDB over MySQL. There is not a big difference between these two, as MariaDB is a drop-in replacement for MySQL. But please refer to the following pages for more information:

Configuring MariaDB

My current estimation is, that most of the action on the database server will be read-only transactions the my.cnf will be optimized towards this. All configuration options can be looked up at https://mariadb.com/kb/en/mariadb/server-system-variables/ which I recommend reading. As for now I dump my my.cnf configuration

Migrating old Databases

Since my setup is not completely from scratch I will migrate the old databases. Most of the databases and tables are stored as MyISAM, which I will change to the default database storage engine InnoDB.

Starting the database

systemctl enable mysqld@.service
systemctl start mysqld@.service

To check the logs issue the following command

journalctl -b -u mysqld.service

PHP-FPM

It’s a little bit tricky to setup PHP since later the hosting users will be read from the froxlor database, but since we do not have it yet a local user will be created for the initial setup.

Enabling and starting PHP-FPM

Webserver (Nginx)

As webserver I decided to use Nginx over Apache mainly because I noticed that Nginx is less memory intense and performs better, but inform yourself!

Configuration

To be able to install froxlor a temporary server has to be set up which is done by adding the following part to the nginx configuration file. Whereas the <IP> should be replaced with the external IP of the server and <HOSTNAME> with a FDQN under which the server is reachable.

Now open a browser and enter http://<HOSTNAME>/ and you should see the froxlor installation screen. Follow the instructions and setup froxlor.

Conclusion

A basic hosting environment has been setup and we can start working on configuring the rest of the system. Later on the previously configured PHP-FPM Pool [www] will be deleted in favor of the froxlor generated pools.

I also would recommend to go through the froxlor panel settings first and then start to configure the other services which I describe in these Posts: