NGINX is a top choice for web servers for its adaptability and strength. Many online services and applications use NGINX and customize it to boost their system’s efficiency, secure their data, and add new features. However, you might find it challenging to configure custom NGINX settings, as it often requires manual edits in the Linux terminal.
But, with xCloud, you can simplify this process. If you add a custom NGINX in xCloud, it lets you easily modify NGINX settings right from the xCloud dashboard, without using any extra command lines.
Understanding The NGINX Config #
NGINX is an open-source web server that provides reverse proxy, load balancing, and caching capabilities. It has HTTPS server capabilities and is primarily intended for optimal performance and stability.
In xCloud, the NGINX server settings are customizable through configuration files in the /etc/NGINX/ folder. The main configuration file can be located at /etc/NGINX/xcloud-conf.
Configure Custom NGINX In xCloud: A Step-By-Step Guide #
With xCloudโs Custom NGINX Config feature, you can add a new configuration directly from the xCloud dashboard. Here, you can add custom configurations for before, after, and inside server blocks. Follow the guide to learn how you can configure custom NGINX in xCloud.
Step 1: Navigate To The NGINX Tab In xCloud #
Log in to your xCloud dashboard and choose the website for which you want to add a custom NGINX. From the left navigation menu, click on the NGINX option.
Step 2: Add A Custom NGINX #
From this tab, you need to tap the โAdd a New Configโ button to configure a custom NGINX. You can run and debug a custom config or save this for later use purposes.
You can choose one from 3 NGINX types: Before Server Block, Inside Server Block, and After Server Block. You can then choose a file name, โRun & Debugโ a custom NGINX, or โSave Configโ.
- If you choose the โBefore Server Blockโ and set a Config File Name, the Config will be generated as /etc/NGINX/xcloud-conf/(sitename)/before/(Config File Name).
- For โInside Server Blockโ and a Config File Name, the Config will be generated as /etc/NGINX/xcloud-conf/(sitename)/server/(Config File Name).
- For โAfter Server Blockโ and a Config File Name, the Config will be generated as /etc/NGINX/xcloud-conf/(sitename)/after/(Config File Name).
For example, if you choose the โInside Server Blockโ and set the Config File Name as โrankmathโ for the site โsummer-star-195.xcloud.nameโ, the config will be generated as /etc/NGINX/xcloud-conf/summer-star-195.xcloud.name/server/rankmath.conf.
Now, using the Config Content below for example:
# START NGINX Rewrites for Rank Math Sitemaps
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
rewrite ^/([a-z]+)?-sitemap\.xsl$ /index.php?xsl=$1 last;
# END NGINX Rewrites for Rank Math Sitemaps
You can then choose to โRun & Debugโ or โSave Configโ.
If you are using Custom NGINX for HideMyWP, make sure to change your settings in the plugin like this, as shown below.
If your custom NGINX command and configurations are okay, you will see a green message upon clicking the โRun & Debugโ.
However, if there are some issues with your configuration and command, you will see a red message.
Once you add a custom NGINX config successfully, it will be listed on the โCustom NGINX Configโ tab. From here, you can edit or delete a config. Additionally, you can preview your configuration.
Custom NGINX Templates #
For now, we are offering built-in custom NGINX support for Rankmath and Hide My WP on the xCloud dashboard. That means, If your website has the Rankmath or Hide My WP plugins installed, you can choose from the โSelect Templateโ list and youโre all good to go. Or else, you can choose โUse My Own Configโ to run your config manually. However, we will be gradually adding more plugins.
That is how easily you can configure custom NGINX in xCloud.
Still stuck? Contact our dedicated support team for any of your queries.