The Nimbus Hosting servers support Magento 2 out of the box so you don’t need to worry about installing any prerequisite software on the server or configuring your vhosts. Our platform can take care of this for you making the setup quick and easy. Here are some handy tips to help you get started with running Magento 2 on the platform.
Adding a Magento 2 site to the Nimbus Hosting platform
You can add a new Magento 2 site to your Nimbus Hosting server by clicking “Websites” and then “Add Website”
from your server’s dashboard.
When adding a website to a server that’s running Magento 2 it’s very important to select the CMS from the application drop down menu regardless of whether you are setting up a new site from scratch, or if you are moving an existing Magento 2 site to the server. This will ensure that that hosting is set up correctly for running Magento 2.
If you are setting up a new site and would like our platform to install the application for you, select Magento 2 from the drop down menu and click “Install Application”.
If you are looking to upload an existing Magento 2 site to the server, again select Magento 2 from the drop down menu but just make sure that “Install Application” is not selected.
By selecting the application from the drop down menu, this will mean that the platform will set up the following for you:
- Correct folder structure for Magento 2
- PHP Limits specifically tuned for Magento 2
- Nginx config
- Scheduled Tasks (Cron Jobs)
Please note that it is not possible to select the application after the site has been added to the platform. It has to be done at the point of adding the site to the platform.
Scheduled tasks (Cron Jobs)
There are three cron jobs that need to be set up in order for Magento 2 to function correctly. These get set up automatically for you if have selected Magento 2 as the application when adding the site to the platform.
You can check these have been set up correctly in the website dashboard under “Scheduled Tasks”
Here is some further reading on how the cron jobs for Magento 2 work:
https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-cron.html
File Permissions
A common problem people often run into when using Magento 2 is incorrect file permissions on the web files for the site. These often come in the form of error messages either on the front end of the website or in the admin backend.
“Permission denied in /home/storm/sites/magento2test-com/var/generated/File.php on line 100”
In our platform it’s very easy to remedy errors such as the above from within the platform itself. To reset your websites file permissions, click on “Reset File Permissions” in your websites dashboard and this will reset the permissions to the Magento 2 recommended defaults.
Folder Structure
Magento have reworked the folder structure for Magento 2 so it’s quite different from the folder structure that Magento 1 used. The main change that catches a lot of people out is that the document root has changed to the ”pub” folder.
Magento 2’s application files now live outside of the document root for security purposes. So the web root is now a folder inside the application itself.
The Nimbus Hosting platform lets you toggle this on and off depending on your requirement via the below toggle button:
Here’s an example to explain this further. I have added the site magento2test.com to my Nimbus Hosting server.
Toggling the option on sets the document root to:
/home/storm/sites/magento2test-com/public/pub
And turning it off sets the document root to:
/home/storm/sites/magento2test-com/public
Amasty have a really good breakdown of the other folders, here’s a link for some further info:
https://amasty.com/knowledge-base/magento-2-file-and-folder-structure.html
Using the Magento 2 CLI
Magento 2 now has a command-line interface for managing many important functions of the application such as:
- Compiling your websites static content
- Enabling the Magento 2 caching
- Changing your Magento 2 websites mode.
Unlike Magento 1, Magento 2 requires a level of familiarity with the Linux command line in order to use the application properly.
Before you run any commands on your Magento 2 site you will need to connect via SSH to the server. Every website that gets added to the platform will have its own website level SSH user and it’s important to use this user to run your commands to avoid issues with permissions.
You’ll need to get add your IP to the servers allowed IP list before you can connect via SSH. This can be done in the server’s main dashboard by clicking on Security and then by clicking the “Add record” button.
Once you have done this, you can find your SSH login details in your website dashboard under the “SSH” tab. We have a more in-depth, step by step guide for getting connected via SSH here if you need it: https://support.nimbushosting.co.uk/support/solutions/articles/36000022440-ssh-access
Now that you are connected via SSH as the websites SSH user you can use any of your Magento 2 commands safely.
For more information on specific Magento 2 CLI commands, please see the following link:
https://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands.html
Magento 2 Modes
Another big difference between Magento 1 and Magento 2 is the introduction of different website modes. Magento 2 has three different modes that you will need to set the site to depending on the situation. These are Default, Developer and Production.
Default Mode is the mode the site will be in out of the box straight after you have installed the application. It’s designed for testing the application on your hosting environment. If Magento 2 is working properly on the server, you should switch from this mode to one of the other modes.
Developer Mode, as the name specifies is the mode your application should be in when you are working and developing your Magento 2 site. This mode will be much slower than production as all the built in caching for Magento 2 will be disabled. Extra debugging features and logging features are enabled when in Developer Mode as well.
Production Mode is the mode your Magento 2 site should be in when development has been completed and it’s in a live production environment. When your Magento 2 application is in Production Mode it should be significantly quicker to load compared to the other 2 modes due to the caching being enabled. It also prevents any errors from being displayed to the end user.
Here’s some more detailed info about each of the modes:
https://devdocs.magento.com/guides/v2.3/config-guide/bootstrap/magento-modes.html
Known Magento 2 Issues
- Invalid Form Key. Please refresh the page - If you see this error when trying to upload to the site and save a product it can be remedied by raising the max_input_vars php variable to 5000 in the php settings for the site.
- Server running out of disk space - There is a known issue with a specific version of Magento 2 (Version 2.2.6) that causes the servers “tmp” folder to fill up with multiple archive files (.tar files). A reboot of the server will clear the files however they will regenerate. The long term fix is to upgrade to a newer version of Magento 2.
Here’s the bug report of the issue:
https://github.com/magento/magento2/issues/18243
Further Information
Magento have their own extensive knowledgebase explaining everything you need to know about Magento 2 which can be found here: https://devdocs.magento.com/guides/v2.2/config-guide/bk-config-guide.html
Another great resource is the Amasty knowledgebase. Amasty has been a provider of many popular extensions for both Magento 1 and Magento 2 over the years and have a lot of useful documentation which can be found here: https://amasty.com/knowledge-base/topic-magento-related-questions.html