Installing ClusterControl with Nginx!

Follow

Comments

2 comments

  • Avatar
    Premium Pest Control

    Very Useful article thanks for sharing a valuable content.

    0
    Comment actions Permalink
  • Avatar
    Social For You

    Phil’s guide (and the official docs) recommend installing ClusterControl using the default installer first, which deploys the web UI and API under Apache:

     
    wget https://severalnines.com/downloads/cmon/install-cc chmod 755 install-cc ./install-cc

    This sets up:

    • ClusterControl UI

    • CMON API

    • Apache with necessary configs
      Even if you plan to use nginx, installing Apache first ensures all files are placed correctly.


    🧱 2. Disable/Stop Apache

    Stopping Apache prevents it from occupying ports 80/443 and avoids conflicts with nginx: 

    Systemd (CentOS/RHEL/Ubuntu newer systems)

     
    sudo systemctl stop httpd sudo systemctl disable httpd

    Debian/Ubuntu (legacy)

     
    sudo service apache2 stop sudo update-rc.d -f apache2 remove

    This keeps Apache installed (so ClusterControl files remain intact) but inactive. 


    📦 3. Install nginx + PHP-FPM

    ClusterControl requires PHP to render and process its UI and API. nginx doesn’t include PHP — instead it passes requests to php-fpm:

    On CentOS/RHEL:

     
    sudo yum install nginx php-fpm -y

    On Debian/Ubuntu:

     
    sudo apt-get install nginx php5-fpm -y

    (Use the appropriate PHP-FPM package for your distro and PHP version.)


    📄 4. Create nginx Site Configuration

    Here’s a working nginx server block based on Phil Bayfield’s example that handles both the ClusterControl UI and the CMON API:

     
    server { listen 80; server_name yourdomain.com; access_log /var/log/nginx/clustercontrol-access.log; error_log /var/log/nginx/clustercontrol-error.log; root /var/www; index index.php; # Deny .htaccess files location ~ \.htaccess { deny all; } # Pass all php requests to php-fpm location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } # Handle ClusterControl UI location /clustercontrol { alias /var/www/clustercontrol/app/webroot; try_files $uri $uri/ /clustercontrol/app/webroot/index.php; } # Needed for UI access (handles query strings properly) set $is_args_amp ""; if ($is_args != "") { set $is_args_amp "&"; } # Handle internal /access calls location ~ "^/clustercontrol/access/(.*)$" { try_files $uri $uri/ /clustercontrol/app/webroot/access/index.php?url=$1$is_args_amp$args; } # Handle CMON API location ~ "^/cmonapi/(.*)$" { try_files $uri $uri/ /cmonapi/index.php?url=$1$is_args_amp$args; } }

    A few notes about this snippet: starbucks menu

    • alias points to ClusterControl’s webroot.

    • fastcgi passes PHP execution to php-fpm.

    • Regex locations ensure the UI and API routes work with query strings (similar to Apache’s mod_rewrite).


    🔁 5. Restart Services

    Once nginx config is in place:

     
    sudo systemctl enable nginx php-fpm sudo systemctl restart php-fpm sudo systemctl restart nginx

    Now nginx serves the ClusterControl UI/API on port 80. You can add SSL later to serve it on HTTPS (port 443).

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk