One of the main benefits of using Moss is that you rarely have to deal with the low-level details of server and site configuration 😊. However, sometimes you need to get your hands dirty and provide extra configuration for your applications.
Moss will honor your own config and won't overwrite it. In this article we tell you how you can set it up.
PHP-FPM extra config
The configuration for PHP-FPM can be found on your servers within directories
<version> are each of the PHP versions installed on your server. For the sake of simplicity, in the remainder of this article we provide examples for PHP 7.0. However everything stated here applies to all supported PHP versions. Just substitute
7.0 for the PHP version you're actually tweaking.
moss@<server>:~$ ls -F /etc/php/7.0/fpm/
conf.d/ php-fpm.conf php.ini pool.d/
Moss sets up some of these configuration files on your behalf. But luckily, you may overwrite the values of the directives you want by including additional
.ini files within
Moss won't overwrite the configuration that you put into those files. Once you're done with the config, log into Moss and provision your website so that PHP-FPM is reloaded.
Nginx extra config
Moss installs and sets up the Nginx web server on your behalf. You can find the Nginx configuration files within the
/usr/local/openresty/nginx/sites/ directories of your server.
You can tweak the configuration of each site by editing the following files:
/usr/local/openresty/nginx/conf/server_params.site.com: Nginx directives within the
serverblock of your
/usr/local/openresty/nginx/conf/root_params.site.com: Nginx directives within the
location /block of your
/usr/local/openresty/nginx/conf/fastcgi_params.site.com: Nginx directives within blocks with FastCGI configs (block
location ~ .php$at the moment) of your
Moss won't overwrite the configuration that you put into those files. Once you're done with the config, log into Moss and provision your website so that Nginx is reloaded.
Apache extra config
Most sites provisioned via Moss either use Nginx in standalone mode or as a reverse proxy in front of Apache. In the latter case, you may fine-tune Apache configs in different ways:
- Create config files within
a2enconfafterwards (e.g. create file
a2enconf myconfig). Since you're changing the global configuration, you must SSH into your server as user
sudo. Once you're done, you must log into Moss and provision your website so that Apache is reloaded.
.htaccessfiles within your sites' directories. Since you're dealing with a given website, you must create these files as the server user that runs such website.
- WordPress users will likely employ a plugin to make some configs like setting up the browser cache, among others. Such plugins could add the required configs to a
.htaccessfile, so you don't need to do it by hand.
Need some examples? Below you can find articles that describe some common use cases:
- How to increase the maximum upload size
- How to set up basic auth for a website
- How to tweak fastcgi params for a website
- How to add rewrite rules in Nginx for a website
- How to set up the cache policy for the resources of a website
Don't hesitate to contact us if you have any other use case in mind 😉.