Bek Btw, is there anyone using mariadb with Flarum?
Yup, but I couldn't tell you any mariadb specific optimizations ? It's pretty similar in function to mysql however.
Bek So It's time to make some optimization..
Cool! Realize however "optimizing" means tuning for a specific purpose on your system. Things that might work for me may make things much worse for you.
A good example would be caching on a SSD versus a spinning disk.
Also realize the amount of allocation will have to have stricter limits, "good enough" rather then "ideal"
Eg usage of opcache is a great method of reducing load times (it caches rendered scripts like php) but I wouldn't suggest doing 256MB for it (since that's %50 of your total resources!)
This all changes again if you change your hardware (like more ram)
I definitely suggest using a search engine for tuning mysql (99% same config applies to mariadb) since there are many different methods of calculating correct tuning of the database
Use opcache for php-fpm, if only a small amount (like 60MB) and see where that takes you
There are different methods of using php-fpm, my personal favorite is ondemand over the others, searching php-fpm ondemand static dynamic can give more info (also this config portion)
Browse methods of optimizing nginx, it's pretty fast anyways but can give you tips for little extra boosts.
Basically, adjust, test, repeat ?
One more thing that has nothing to do with optimization - make sure you have automated [maybe incremental] backups set up (ideally before all this) and make sure it at least backs up your webdata (like flarum) and your /etc directory. Optimizing will eventually be a euphemism for "My system is broken!"
Having old functioning config files will be a life-saver.
I use rsnapshot, but there are many excellent ways of doing it. All are better then no backup system in place.