Want to subscribe to topics you're interested in?
Become a Member

Upgrade Nginx Insight Guide Centmin Mod Configuration Files

Discussion in 'Centmin Mod Insights' started by eva2000, Jul 17, 2015.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    53,558
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    11:51 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    For Centmin Mod a lot of the configuration file settings are dynamically configured based on the detected server hardware configuration like number of cpu cores, amount of memory installed and free/available and amount of disk space used as well as type of server environment detected - whether it by barebones dedicated or virtualized environments like OpenVZ, KVM and Xen.

    With this in mind, if you're backing up or restoring configuration files to different servers, web hosts or different virtualization environments, you may need to adjust some configuration files yourself. Or backup the new environment Centmin Mod LEMP installed server's config files and do a side by side comparison of the new environment config files and your backed up copies. I use BeyondCompare for side by side file/directory comparisons.

    Centmin Mod Command Shortcuts



    As some of the configuration file paths are long, remembering them all can sometimes be a chore. So Centmin Mod has command line shortcuts for some. You can see a full list of command line shortcuts in FAQ item 16 on official site.

    Nginx



    Nginx server has many configuration files.
    • /usr/local/nginx/conf/nginx.conf - main Nginx configuration file for server itself. The nginx.conf worker_processes value is dynamically configured based on a formula to dynamically allocate a value based on number of cpu cores available and set it so that some cpu cores are left for non-nginx services. So worker_processes value will always be less than number of cpu cores available. However, Nginx relies on various directories and config files are located at /usr/local/nginx/conf which is auto backed up to time stamped directory at /usr/local/nginxbackup everytime you run centmin.sh menu option 4 to upgrade, downgrade or recompile Nginx server. The back up directory is set by centmin.sh variable NGINXBACKUPDIR='/usr/local/nginxbackup'.
    • /usr/local/nginx/conf/conf.d - directory where each Nginx vhost domain config file is located. These files are created when you use centmin.sh menu option 2 to add a new site domain or use new Centmin Mod .08 beta 03 and higher featured /usr/bin/nv command line approach to add a new site domain.
    • /usr/local/nginx/conf/conf.d/virtual.conf - default main Nginx vhost config file for main hostname which is separate from your created site domain Nginx vhost config files. Getting Started Guide explains and illustrates the differences in step 1. The /usr/local/nginx/conf/conf.d/virtual.conf file has it's web root at /usr/local/nginx/html containing statistics and admin files as outlined here. These files are generally created with dynamically random prefixes so are unique to each Centmin Mod installation and as such the /usr/local/nginx/conf/conf.d/virtual.conf entries for password protection etc are set to unique specific location context matches for those dynamically generated files. So if you change name of those random prefix generated files in /usr/local/nginx/html, you will need to edit the associated location context matched values in /usr/local/nginx/conf/conf.d/virtual.conf
    • /usr/local/nginx/conf/ssl/ - directory where you should have installed your SSL certificates for your domain. If you used the new Centmin Mod .08 beta 03 and higher featured /usr/bin/nv command line approach to add a new site domain and set -s y option, the self-signed SSL certificates would be created in /usr/local/nginx/conf/ssl/yourdomain/ directory.
    • /usr/local/nginx/conf/staticfiles.conf - default static files include file which is included in each Nginx vhost config file i.e. /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • /usr/local/nginx/conf/php.conf - main Centmin Mod created PHP include file which is included in each Nginx vhost config file i.e. /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Everytime you edit any of these Nginx config or include files, you need to restart nginx service.

    Nginx Site Domain


    PHP-FPM



    PHP-FPM also have a few configuration files.
    • /usr/local/etc/php-fpm.conf - main PHP-FPM configuration file. Has dynamically configured values for some settings depending on Centmin Mod initial install time detected server resources available i.e. amount of installed memory and free available memory. Everytime you edit this, you need to restart php-fpm service.

    MariaDB MySQL


    • /etc/my.cnf - MariaDB MySQL main mysql settings file. Has dynamically configured values for some settings depending on Centmin Mod initial install time detected server resources available i.e. amount of installed memory and free available memory. Everytime you edit this, you need to restart mysql service.
    • /var/lib/mysql - directory where your MySQL databases reside. You CAN NOT just backup these files, touching them this way will corrupt your database data. You need to properly backup MySQL databases using mysqldump command which is the safest and most reliable way to backup MySQL databases. PHP or web based tools like phpmyadmin are unreliable for larger MySQL databases as they risk timing out and thus resulting in incomplete backups.

    CSF Firewall


    • /etc/csf/csf.conf - main CSF Firewall config file. Has server environment specific settings so be careful some server environments like OpenVZ do not support some of the settings that are dynamically configured on Centmin Mod install for non-OpenVZ servers. Everytime you edit this you need to restart csf service.
    • /etc/csf/ directory also contains other config files that /etc/csf/csf.conf relies on. Everytime you edit any of those files in /etc/csf/, you need to restart csf service.

    Memcached Server


    • /etc/init.d/memcached - Memcached server's config settings are located within the init.d startup file itself. Everytime you edit this you need to restart memcached service.

    NSD DNS


    • /etc/nsd/nsd.conf - NSD main config file if you chose to setup domain DNS on your server locally via centmin.sh menu option 3. Example posted on forums here. If you did not setup NSD DNS locally but used a 3rd party DNS nameservers for your domains, then you do not need to be concerned with NSD.
    • /etc/nsd/ - directory for other related NSD config files and DNS zone files.
    • Everytime you edit any of those files in /etc/nsd/, you need to restart nsd service.


     
    Last edited: Jul 17, 2015
  2. eva2000

    eva2000 Administrator Staff Member

    53,558
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    11:51 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
Thread Status:
Not open for further replies.