2.4 Use Midnight Commander to Change VPS Settings

One of the biggest challenges of working with a virtual server is that it does not come with a desktop environment. Rather than clicking buttons, you need to enter commands in a terminal. The problem with the terminal is that, it can be very difficult for visual learners (who make up half the population) to be constantly entering a series of complex commands into an abstract tool like the terminal. Thankfully, the Linux community also provides a graphical user interface for a server File Manager called Midnight Commander. In this article, we will learn how to use Midnight Commander to change some important settings on our Debian VPS.

Install Midnight Commander
In a previous article, we installed Midnight Commander on our server with this command: sudo apt-get install mc

Once Midnight Commander is installed, you can open it by starting and SSH session and then type mc. Then press Enter. Here is the initial interface when opening Midnight Commander on a server:

01

On a server, you may need to navigate with the up and down arrows and select folders by pressing Enter on your keyboard. You can gain more function by using SSH to access the server from your home computer. Midnight Commander uses a double panel screen. The purpose of this double panel arrangement is to make it easy to copy files from one panel and paste them into the other panel. The panels are labeled Left and Right. Above the panels are a menu that applies to both panels with the menu items called File, Command and Options. Each menu item has a series of sub-menu items, some of which we will cover in this tutorial.

Configure Midnight Commander
Most server tutorials use the initials MC to stand for Midnight Commander. We will do the same in this tutorial.

Change the background to a lighter color
By default, MC comes with light letters on a dark background. However, using dark letters on a light background is both easier to read and easier to see on screen shots. Therefore the first thing you should do after installing MC is to change the background color. To do this, click Options, Appearance.

02

The default skin is called Default. Press Enter to see more options.

03

Click Gray, Green Purple (in a server, you would need to use the up or down arrows to select it). Then press Enter. Then press OK.

04

Navigating between Folders
There are three hidden ways to navigate between folders. The first is to notice and click on the two dots at the top of the right panel. Then press Enter. This takes us to the Parent folder which in this case is called /debian. Then select the two dots again. Then press Enter.

05

When working on our server, we are mostly concerned about files in our etc folder. Click on it in the right column to select it. Then press Enter to open it.

06

A few folders appear at the top of the list and are not in alphabetical order. These include Network Manager. But most of the folders (and there are many in the etc folder) do appear in alphabetical order.

All folders have a slash in front of their name. There are two additional hidden ways to navigate between folders. First, click the small left pointing arrow in the upper left corner to return to the previous folder.

07

Second, click on the very small down pointing arrow in the upper right corner. This will bring up a history popup where you can click and select any recent previous folder.

08

Click on the /etc folder to open it again.

How to Open and Edit Files
Use the down arrow to scroll down the list. Below the folders are a series of files all of which are in alphabetically order. The most important (and oldest) file is called etc/hosts. Scroll down and select this file. If you press Enter, you will notice that files do not open in MC the way they do with the Debian File Manager. MC uses a different process to open files. If you simply want to view the file, then Press F3 on your keyboard.

09

You can use etc/hosts to force your browser to display local websites that do not actually exist on the real public Internet. This is a very useful trick for local development. To close a file opened with F3, press F3 again on your keyboard.

Recall that to edit the /etc/hosts file with our terminal, we use the command sudo nano /etc/hosts With MC, we edit a file by pressing F4 (or click File, Edit). The first time we edit a file, MC will ask us what editor we want to use.

10

Type 1, then press Enter to use the Nano editor. The ect/hosts file will appear. However, at the bottom it will say "File is unwritable" because this file is owned by root and we did not open the file as root. To edit files on our server, make sure our VPS has a root password. Then start an SSH session with ssh root@vps-ip-address>

Then enter the root password and open Midnight Commander with mc. To close a file with MC, use the standard Nano command (press Control plus x). To close MC and return to the terminal, click File Exit. To close the terminal, type exit. Then press Enter.

Use Midnight Commander to Configure PHP Settings
This step only needs to be done once on your server. However, it should be done before you install your first Joomla website.

We need to edit the PHP ini file which is in the following path: /etc/php/8.x/fpm/php.ini

Note: The Line numbers in PHP 8.2 may be slightly different than the line numbers on PHP 8.1.

Click on etc to open your etc folder. Then click on the php folder to open it. Then click on the 8.x folder (or the 8.x folder) to open it. Then click on the fpm folder to open it. Select the file called php.ini

11

After selecting php.ini, click File, Edit to open the php.ini file. Type 1 to select the Nano editor. Then press Enter. Note that there are nearly 2000 lines in this file. To add line numbers to the Midnight Commander edit screen, press Alt plus c to show the line numbers.

Use the down arrow to scroll down to line 226 which does not have a semi-colon in front of it and is therefore active. Change output_buffering = 4096 to output_buffering = Off.

Fix other bad PHP INI default settings
The PHP INI file also has several other truly ridiculous default settings that should have been updated years ago. Thankfully, these only need to be fixed once – when you are first setting up your VPS. Here are three important settings to change:

#1 Use the down arrow to scroll down to line 409. Change the max_execution_time from 30 to 600 (seconds).

#2 Scroll down to line 419 and change the max_input_time from 60 seconds to 600.

#3 Scroll down to line 430 and change the memory_limit from 128M to 256M.

#4 Scroll down to line 698 and increase post max size from 8M to 128M: post_max_size = 128M

#5 Scroll down to line 850. Increase upload max file size from 2M to 100M. (this will allow us to upload short videos).

#6 At line 853. Increase max file uploads from 20 to 40. This will allow us to upload up to 40 images at a time instead of the current 20.

#7 Then scroll down to line 878. Change default_socket_timeout from 60 to 600 (seconds).

Note that some values are related to other values. The order from biggest to smallest should be: memory_limit 256 > post_max_size 128 > upload_max_filesize 100

Then save the PHP INI file with Control plus o followed by Enter. Then close the file with Control plus x. Then click on the two dots a couple of times to go back to the etc folder.

Next open the /etc/apache2/apache2.conf file and change:

In the Global configuration section, Timeout increase from 30 to 300. Then save the file with Control plus o followed by Enter. Then close the file with Control plus x.

Open the /etc/nginx/nginx.conf file and change:

fastcgi_connect_timeout from 30 to 180s

fastcgi_read_timeout increase to 300s

proxy_connect_timeout from 30 to 600s
Then save the file with Control plus o followed by Enter. Then close the file with Control plus x. Then type the word exit and press Enter to close Midnight Commander without turning off your server. Then type exit and press Enter to close ssh session without turning off server. Then close the terminal.

Restart several Hestia Services for changes to take effect
Back at the Hestia Admin screen, click on Server settings, Configuration and restart apache, mariah db, nginx and php8.x-fpm. You are now ready to add as many Joomla websites as you want!

What’s Next?
In the next article, we will use Hestia to install Joomla first on the primary domain name and then install our Freedica social network on a sub domain name.