Articles

Customizing the Apache Configuration

Careful! We can't provide support for customizations or for any errors, downtime, or vulnerabilities you introduce through customizations.

Unless you're absolutely sure about what you're doing, you should stop now!
Using .htaccess files is a safe way to configure Apache and use mod_rewrite, which is enabled by default.

Most commonly, customizing the Apache configuration of individual apps (a.k.a. virtual hosts or vhosts) is what you're trying to do. In a few cases, you may be looking to make global customizations.

App (Virtual Host) Customizations

Adding App Configurations

The easiest way to customize an app's Apache configuration is to add new files in the directory:

/etc/apache-sp/vhosts.d/APPNAME.d

Note that Apache loads configuration files from the above directory in alphabetical order.

Changing Default App Configurations

Every app starts with the following Apache files created by ServerPilot:

/etc/apache-sp/vhosts.d/APPNAME.conf
/etc/apache-sp/vhosts.d/APPNAME.d/main.conf

If you must modify either of these files, you must first rename the file so that ServerPilot won't overwrite your changes.

If you edit APPNAME.conf, rename it to APPNAME.custom.conf.

If you edit main.conf, rename it to main.custom.conf.

Global Customizations

If you need to customize the global Apache configuration, you can add configuration files in the directory:

/etc/apache-sp/conf.d

Any configurations added in the above directory will be loaded in the global Apache context.

After making any changes, restart Apache by running the following command as root:

sudo service apache-sp restart