Customize the Nginx configuration
Global vs. app customizations
When the customizations you’re making are for a specific app, it’s best to perform app customizations rather than global customizations.
App customizations
After making configuration changes, restart Nginx with the following command:
sudo service nginx-sp restart
Adding app configurations
The easiest way to customize an app’s Nginx configuration is to add new
files in the app’s Nginx configuration directory.
Replace APPNAME
with the name of the app.
/etc/nginx-sp/vhosts.d/APPNAME.d
Nginx loads configuration files from the above directory in alphabetical order.
Changing default app configurations
Every app starts with the following Nginx files created by ServerPilot:
/etc/nginx-sp/vhosts.d/APPNAME.conf/etc/nginx-sp/vhosts.d/APPNAME.d/main.conf
ServerPilot will overwrite your changes to these files if you do not rename the files as follows:
- To customize
APPNAME.conf
, rename the file toAPPNAME.custom.conf
. - To customize
main.conf
, rename the file tomain.custom.conf
.
Global customizations
After making any changes, you must restart Nginx.
sudo service nginx-sp restart
Main context
If you need to customize the Nginx main
context,
add configuration files in the directory:
/etc/nginx-sp/core.d
Any configurations added in the above directory will be loaded in the
Nginx main
context.
HTTP context
If you need to customize the Nginx http
context,
add configuration files in the directory:
/etc/nginx-sp/http.d
Any configurations added in the above directory will be loaded in the
Nginx http
context.
Event context
If you need to customize the Nginx events
context,
add configuration files in the directory:
/etc/nginx-sp/events.d
Any configurations added in the above directory will be loaded in the
Nginx events
context.