We’ve made it as easy as possible to work with Magento 2 on our Bolts. We have eliminated the sysadmin part. Reading this document will save you a lot of time, if you plan on following online recipes or copy and paste from the official Magento 2 Documentation.
You can find lots of complicated solutions in online documentation. Solutions you won’t actually need to worry about because we’ve already taken care of that. Magento 2 works as it should, fast, secure and flexible without any extra configuration, setup or tweaking needed.
No Need To Worry
Here are the most common things you don’t need to worry about
1. There is no need to use sudo
There is never any need to run commands with sudo
or work with root
rights on your Bolt. When you log in using SSH on your Bolt. You are always the correct user with the correct set of permissions when you log in with SSH. Always.
We’ve configured our Bolts in such a fashion that there’s no need to ever change server configuration files. In a managed and optimized Magento 2 hosting environment, these kinds of changes should never be necessary.
Having said that, if there is something that you think requires configuration changes, please contact support and we’ll be happy to help you figuring out how to solve your problem.
2. File and Directory Permissions and Groups
On a Bolt, all files part of your Magento 2 installation simply require read and write permissions for the owner (chmod 600
). Directories need read, write and execute permissions for the owner (chmod 700
).
By default, you are the correct owner when you are log in through SSH. You never have to run file system commands like chmod, umask, chgrp. File and directory permissions are simply never an issue on your Bolt.
To be clear, never follow recipes or advice that says “set 755 or 777 permissions”, it will not only make your installation less secure, it will not solve any problems either.
Here’s an example of something often written in M2 documentation, that you don’t need to do on Servebolt. In fact, should not do:
find var generated vendor pub/static pub/media app/etc -type f \-exec chmod g+w {} + && \find var generated vendor pub/static pub/media app/etc -type d \-exec chmod g+ws {} + && \chown -R :www-data . && chmod u+x bin/magento
Working with Magento over SSH
Easy magento command
You can, and should, simply write magento
instead of writing php bin/magento
. You can run the magento
command from your root folder, or in the public folder. It will automatically find your Magento 2 installation.
Avoid doing things like this, because as mentioned above, it is not necessary.
chmod u+x bin/magento
If you copy & paste commands with bin/magento
from the internet, just remove the bin/
part and just use magento
.
Every single Magento 2 installation, by default, has the n98-magerun2 command line tool extension available. Just type magerun2
and you’ll quickly discover all the extra options compared to the default Magento 2 command line tool.
Debugging and Logging
Easy tailerrors command
You can write tailerrors, and the command will automatically show you new entries that are added to logs/Errorlog
and public/var/log/exception.log
and public/var/log/system.log
.
To exit from tailing the error logs, just hit CMD+C (Mac) or CTRL+C (PC).
Making shortcut commands
Developers often use commands like this, to do everything in one go:
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* generated/* && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento setup:upgrade && php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy -f
This one, can be simplified to
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* generated/* && magento cache:clean && magento cache:flush && magento setup:upgrade && magento setup:di:compile && magento setup:static-content:deploy -f
Next steps
Now that you’ve got Magento 2 running fast, secure and smooth on your Servebolt Bolt, here are some additional documentation articles you should check out: