The ea-nginx Script


Last modified: April 12, 2023

Overview

Important:
This script only works with the EasyApache 4 implementation of NGINX®.

The /usr/local/cpanel/scripts/ea-nginx script manages your NGINX configuration. This script will configure or remove an NGINX user, reload the user configuration, and manage the cache. To learn more about NGINX with cPanel & WHM, read our NGINX Manager and NGINX with Reverse Proxy documentation.

This script creates the user’s configuration file in the following location:

Note:

In the following example, username represents the username.

/etc/nginx/conf.d/users/username.conf 

Run the script

To use this script, run the following command as the root user:

/usr/local/cpanel/scripts/ea-nginx [options]

Note:
This script’s available options change, depending on how you use the script. For more information, read the Options section below.

Options

This script accepts the following options, depending on the action required:

Note:

In the following tables, user represents the cPanel username.

Configure NGINX users

To configure a user for NGINX, run the following command:

/usr/local/cpanel/scripts/ea-nginx config  [options]

You can use the following options with this script:

Options
Description Example
user Configure a specific cPanel account username for NGINX.
Note:
  • You must pass either the user or --all option, but not both.
  • This option also clears the user's cache.
config user
--all Configure all cPanel accounts for NGINX.
Note:
  • You must pass either the user or --all option, but not both.
  • This option builds the user configurations in parallel.
  • To configure the --all option to always build the user configuration serially, create the /etc/nginx/ea-nginx/serial_config_mode touch file.
config --all
--no-reload Do not immediately reload the user’s NGINX configuration.
Important:
  • You can only use this option with the config or remove options.
  • You must pass the reload option by itself when you're ready to load the changes into your NGINX configuration.
config user --no-reload
--serial Rebuild the user configurations serially rather than in parallel.
Note:
You can only use this option with the --all option.
config --all --serial
--global Only rebuild global NGINX configurations. This option also executes any scripts in the /etc/nginx/ea-nginx/config-scripts/global/ directory. config --global

Remove NGINX users

To remove a user from NGINX, run the following command:

/usr/local/cpanel/scripts/ea-nginx remove  [options]

You can use the following options with this script:

Options
Description Example
user Remove a user from your NGINX configuration. remove user
--no-reload Do not immediately reload the user’s NGINX configuration.
Important:
  • You can only use this option with the config or remove options.
  • You must pass the reload option by itself when you're ready to load the changes into your NGINX configuration.
config user --no-reload

Configure a user NGINX cache

To configure a cPanel user’s NGINX caching, run the following command:

/usr/local/cpanel/scripts/ea-nginx cache user [options]

You can use the following options with this script :

Options
Description
Example
--reset Remove a specific cPanel user’s cache configuration and use the system’s configuration.
Note:
You must pass either the --reset or --enabled option, but not both.
--reset
--enabled Enable or disable the cPanel user’s cache. You can set the following values:
  • 1 — Enable the user’s cache.
  • 0 — Disable the user’s cache.
Note:
  • You must pass either the --reset or --enabled option, but not both.
  • This option also clears the user's cache.
--enabled=1
--no-rebuild Do not reload NGINX immediately or rebuild the NGINX configuration.
Note:
You must pass the config option when you’re ready to rebuild the changes to your NGINX configuration.
--no-rebuild

Configure the system NGINX cache

To configure the system’s NGINX caching, run the following command:

/usr/local/cpanel/scripts/ea-nginx cache --system [options]

You can use the following options with this script:

Options
Description
Example
--reset Sets the system’s configuration to default values.
Note:
You must pass either the --reset or --enabled option, but not both.
--reset
--enabled Enable or disable the system’s cache. You can set the following values:
  • 1 — Enable the system’s cache.
  • 0 — Disable the system’s cache.
Note:
You must pass either the --reset or --enabled option, but not both.
--enabled=1
--no-rebuild Do not reload NGINX immediately or rebuild the NGINX configuration.
Note:
You must pass the config option when you’re ready to rebuild the changes to your NGINX configuration.
--no-rebuild

Clear the NGINX cache

To clear a user’s NGINX cache, run the following command:

/usr/local/cpanel/scripts/ea-nginx clear_cache [options]

You can use the following options with this script:

Options
Description Example
user Clear the NGINX cache for one or more users.
Note:
You must pass either the user or --all option, but not both.
clear_cache user1 user2
--all Clear the NGINX cache for all users on the system. clear_cache --all

Additional options

To perform additional actions with this script, run the following command:

/usr/local/cpanel/scripts/ea-nginx  [option]

You can also use the following options with this script:

Options
Description
Example
help [option] Display the script’s help information.
Note:
If you specify an option, only that option’s help information will appear.
help reload
hint [option] Display the abbreviated help information.
Note:
If you specify an option, only that option’s hint information will display.
hint reload
reload Reload your NGINX configuration.
Note:
  • You must pass this option if you passed the --no-reload option when configuring the NGINX system or users.
  • This option also clears the user's cache.
reload

Additional Documentation