1.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:


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.


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


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.


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.


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.


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.


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.


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.


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.


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
The 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/7.4/fpm/php.ini

Note: As of 2022, new Hestia installations are using PHP 8 by default. Therefore the path will be /etc/php/8.x/fpm/php.ini Also note that the Line numbers in PHP 8 are slightly different than the line numbers on PHP 7.4.

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


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 1947 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 215 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 388. Change the max_execution_time from 30 to 300 (seconds).

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

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

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

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

#6 At line 849. 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 874. 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 php7.4-fpm (or php8.x-fpm). You are now ready to add as many Joomla websites as you want!

Fix SpamHaus 550 Error Email Rejections

Historically, emails are blocked or rejected either due to using a blacklisted domain name, such as spammers dot com, or using a blacklisted IP address such as 123.456.789.001. However during the past two years, a new type of email rejection has become common. The SpamHaus 550 Email Rejected error occurs when you are using SpamHaus as an email filter and are using an open DNS resolver to convert domain names to IP addresses and back again. Strangely, outgoing emails are not blocked – but incoming emails as well as replies to outgoing emails are rejected.

This error can occur regardless of whether you are using the free open source Hestia Control Panel or the commercial cPanel control panel to set up your email system as both use the Exim email system. The problem with Exim is that Exim uses SpamHaus as one of its two default spam filters. The problem with using SpamHaus is that it has recently adopted a policy of not working with open source DNS resolvers. This is an insane policy.

To make matters worse, SpamHaus 550 error warnings are extremely misleading. The SpamHaus 550 error warning claims that you have a bad domain name and or a bad IP address when the truth is they are rejecting your emails because you are using an open source resolver!

To add insult to injury, SpamHaus does not appear to do this to older VPS accounts. These are grandfathered in. It is only some newer VPS accounts that have this problem.

To determine the DNS resolver for your VPS, start an SSH session, type mc to open Midnight Commander and go to /etc/resolv.conf. Here you will find that the file is empty – meaning that by default, Hestia does not appear to use an internal DNS resolver. Instead, Hestia defers to external resolvers – which is likely to be the Google resolver – which is technically an open source resolver.

What SpamHaus wants all of us to do to end this email rejection nightmare is to go to their website and register for a free account. They will then give you a key which will allow you to continue to use an open source DNS resolver.

However, in my opinion, their “solution” borders on the insane. It is ridiculous to expert one billion people to go to their website and register to get a free key. Instead, if you are having this incoming email SpamHaus rejection problem, then while in Midnight Commander, go to the etc/exim4 folder and select the dnsbl.conf file. Then click File, Edit in Midnight Commander to see this screen:

1.4 end

Delete the line zen.spamhaus.org – leaving only bl.spamcop.net. Spam Cop is similar to SpamHaus but will allow you to use open source resolvers.

Then type the word exit to exit Midnight Commander. Then type exit to exit the SSH session.

Then open a browser tab to log into your Hestia control panel. Then click on the Settings wheel. Then click on the Exim4 restart icon to restart Exim4 and have the change you made take effect. Then test your email system. You should now be able to send and receive emails to and from your custom domain name related email accounts without any SpamHaus 550 error rejections.


What’s Next?
In the next article, we will use Hestia to install Joomla.