Get the most out of your Centmin Mod LEMP stack
Become a Member

Install Moving Xenforo site to Centminmod, only loads a blank page.

Discussion in 'Install & Upgrades or Pre-Install Questions' started by RC Mike, Aug 9, 2020.

  1. RC Mike

    RC Mike New Member

    9
    4
    3
    Mar 19, 2019
    Ratings:
    +4
    Local Time:
    10:51 PM
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.19.1
    • PHP Version Installed: 7.4.4
    • MariaDB MySQL Version Installed: i.e. 10.0.x or 10.1.xx or 10.2.xx
    • When was last time updated Centmin Mod code base ? : last night
    • Persistent Config:
    Code:
    LETSENCRYPT_DETECT='y'
    DUALCERTS='y'
    
    /usr/local/nginx/conf/conf.d/

    Code:
    #x# HTTPS-DEFAULT
     server {
      
       server_name MYOWNDOMAIN.com www.MYOWNDOMAIN.com;
       return 302 https://MYOWNDOMAIN.com$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    
    server {
      listen 443 ssl http2 reuseport;
      server_name MYOWNDOMAIN.com www.MYOWNDOMAIN.com;
    
      include /usr/local/nginx/conf/ssl/MYOWNDOMAIN.com/MYOWNDOMAIN.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # cloudflare authenticated origin pull cert community.centminmod.com/threads/13847/
      #ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/MYOWNDOMAIN.com/origin.crt;
      #ssl_verify_client on;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      http2_max_requests 50000;
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      #add_header Feature-Policy "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/MYOWNDOMAIN.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/MYOWNDOMAIN.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/MYOWNDOMAIN.com/autoprotect-MYOWNDOMAIN.com.conf;
      root /home/nginx/domains/MYOWNDOMAIN.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
    #  location / {
    #  include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
     # }
    
    location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$uri&$args;
    
    }
    
    location /install/data/ {
    internal;
    }
    
    location /install/templates/ {
    internal;
    }
    
    location /internal_data/ {
    internal;
    }
    
    location /library/ {
    internal;
    }
    
    # xenforo 2 uncomment / remove hash from next 3 lines
    location /src/ {
    internal;
    }
    
      include /usr/local/nginx/conf/pre-staticfiles-local-MYOWNDOMAIN.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
     
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    I've setup a new VPS running CentOS 7 and Centminmod and cloudflare. After the install the default created index.html file loaded without issue using SSL (from Lets Encrypt) and all was good thus far.

    Then I created a zip of all the files from the old server under PUBLIC as well as created a dump of the database.

    Ran wget to download the zip and sql dump to the new centminmod server and unzipped and imported the database.

    When I refreshed the new site the only thing that loaded was a blank page. Viewing source shows 1 line and it's blank.

    I then remembered to update the config.php file under /src/ with the new database credentials and refreshed the page.

    But again the site loads a blank page.


    What am I missing or doing wrong? Any suggestions?
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  3. hazehs

    hazehs Member

    34
    1
    8
    Jul 18, 2020
    Ratings:
    +6
    Local Time:
    2:51 AM
    NGINX 1.18
    MariaDB 10.4
    Hey,

    first be careful using the https redirect in nginx - or disable it in cloudflare. You can get a error with "too many redirects".

    I also moved two times the xenforo with centminmod.
    When you got a "white page" then there is something wrong with mysql connection.
    Check your src/config.php if everything is right.

    Have you created a user for your database when importing it?
    If not, this will help you: Centmin Mod Addons - CentminMod.com LEMP Nginx web stack for CentOS
    easy creating database with the right permissions.
    Be sure the password, databasename and username a correct.

    Second; you need to do the right file permissions and the autoprotect.sh need some fixes for xenforo.
    you can see it there:
    Nginx Rewrites for Xenforo Friendly Urls - CentminMod.com LEMP Nginx web stack for CentOS

    Code:
    find /home/nginx/domains/newdomain.com/public/ -type f -print0 | xargs -0 chmod 0644
    find /home/nginx/domains/newdomain.com/public/ -type d -print0 | xargs -0 chmod 0755
    find /home/nginx/domains/newdomain.com/public/internal_data/ -type f -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/newdomain.com/public/data/ -type f -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/newdomain.com/public/internal_data/ -type d -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/newdomain.com/public/data/ -type d -print0 | xargs -0 chmod 0777
    chmod 0755 /home/nginx/domains/newdomain.com/public
    Code:
    touch /home/nginx/domains/newdomain.com/public/library/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/internal_data/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/install/data/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/install/templates/.autoprotect-bypass
    touch /home/nginx/domains/newdomain.com/public/src/.autoprotect-bypass
    Also recompile Nginx with some more custom commands, if you want:
    Code:
    GINX_SSLCACHE_ALLOWOVERRIDE='y'
    MARIADB_INSTALLTENTHREE='y'
    SET_DEFAULT_MYSQLCHARSET='utf8mb4'
    AUTOHARDTUNE_NGINXBACKLOG='y'
    ZSTD_LOGROTATE_NGINX='y'
    ZSTD_LOGROTATE_PHPFPM='y'
    NGINX_ZERODT='y'
    NGINX_LIBBROTLI='y'
    NGXDYNAMIC_BROTLI='y'
    PHP_PGO='y'
    PHP_BROTLI='y'
    PHP_LZFOUR='y'
    PHP_LZF='y'
    PHP_ZSTD='y'
    SELFSIGNEDSSL_ECDSA='y'
    LETSENCRYPT_DETECT='y'
    DUALCERTS='y'
    AUDITD_ENABLE='y'
    #SKIP_INITIAL_PIP_UPDATES='y'                    #For faster centmin loading
    #SKIP_PIP_UPDATES='y'                                  #For faster centmin loading
    #SKIP_FIXPHPFPM_HTTPPROXY='y'             #For faster centmin loading            You can do that after installing i think
    #SKIP_FIXWP_UPDATER='y'                           #For faster centmin loading
    #SKIP_CSF_MAXMIND_REGO='y'                   #For faster centmin loading
    SSL_PROTOCOL_MODERN='y'
    NGINX_MODSECURITY_MAXMIND='y'
    NGINX_MODSECURITY='y'
    
    maybe that will help you.


    regards

    @eva2000

    you were 1 min faster lol
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    FYI, if you still have access to old Centmin Mod install, you can backup the permissions there and restore them all on new server too from guide at Nginx Rewrites for Xenforo Friendly Urls - CentminMod.com LEMP Nginx web stack for CentOS using getfacl and setfacl commands

    On old server. first backup your /public web root file and directory permissions to already created /home/nginx/domains/newdomain.com/backup directory just in case using below SSH command:
    Code (Text):
    getfacl -R -L --absolute-names /home/nginx/domains/newdomain.com/public > /home/nginx/domains/newdomain.com/backup/backup-permissions-$(date +"%d%m%y-%H%M%S").acl
    

    Then copy over the /home/nginx/domains/newdomain.com/backup/backup-permissions-XXXXXX-XXXXXX.acl file to new server and place in same place at /home/nginx/domains/newdomain.com/backup/backup-permissions-XXXXXX-XXXXXX.acl
    Then on new server, you can restore them using this SSH command where XXXXXX-XXXXXX is the day-month-year-hr-min-sec timestamp from the above backup command:
    Code (Text):
    setfacl --restore=/home/nginx/domains/newdomain.com/backup/backup-permissions-XXXXXX-XXXXXX.acl
     
  5. RC Mike

    RC Mike New Member

    9
    4
    3
    Mar 19, 2019
    Ratings:
    +4
    Local Time:
    10:51 PM
    Thanks guys for the replies so far. I really think @hazehs is right, that it's a database issue, I'm just not sure what exactly I've done wrong.

    During the copy from the old server to the new server I used the following command to compress the files:
    Code:
    tar -vcf backupfilename.tar .
    Then did a wget on the new server to download the file and use the following command to expand the file:

    Code:
    tar -vxf backupfilename.tar
    To dump the database file I did the following command:
    Code:
    mysqldump --user=homegar_us3r1 -p [database name] > [backup file name].sql
    On the new Centminmod server I ran the following command to create a new database (I got it from a Centminmod, either a page or forum post - I can't remember exactly now)
    Code:
    /usr/local/src/centminmod/addons/mysqladmin_shell.sh createuserdb DATABASENAME DBUSER DBPASSWORD
    Then used the following command to restore the dumped file from the old server:
    Code:
    mysql -u USER -p DATABASE < homebak.sql
    In regards to file permissions I've ran the following commands as well:
    Code:
    touch /home/nginx/domains/MYOWNDOMAIN.com/public/library/.autoprotect-bypass
    touch /home/nginx/domains/MYOWNDOMAIN.com/public/internal_data/.autoprotect-bypass
    touch /home/nginx/domains/MYOWNDOMAIN.com/public/install/data/.autoprotect-bypass
    touch /home/nginx/domains/MYOWNDOMAIN.com/public/install/templates/.autoprotect-bypass
    touch /home/nginx/domains/MYOWNDOMAIN.com/public/src/.autoprotect-bypass
    
    find /home/nginx/domains/MYOWNDOMAIN.com/public/ -type f -print0 | xargs -0 chmod 0644
    find /home/nginx/domains/MYOWNDOMAIN.com/public/ -type d -print0 | xargs -0 chmod 0755
    find /home/nginx/domains/MYOWNDOMAIN.com/public/internal_data/ -type f -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/MYOWNDOMAIN.com/public/data/ -type f -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/MYOWNDOMAIN.com/public/internal_data/ -type d -print0 | xargs -0 chmod 0777
    find /home/nginx/domains/MYOWNDOMAIN.com/public/data/ -type d -print0 | xargs -0 chmod 0777
    chmod 0755 /home/nginx/domains/MYOWNDOMAIN.com/public

    Granted I did run all the commands on the new server using ROOT and not the FTP user I created during the vHost setup in the Centminmod (option 2).

    So I believe the permissions are good. The config.php file in /src/ has the new database info that I created using the step I mentioned above, using mysqladmin_shell.sh.

    My old setup used 127.0.0.1 for $config['db']['host'] and have tried that and localhost but both have made no difference.

    I guess it could be file permissions but I am really under the impression that it's still a database issue.
     
  6. RC Mike

    RC Mike New Member

    9
    4
    3
    Mar 19, 2019
    Ratings:
    +4
    Local Time:
    10:51 PM
    I got it.

    I added this line to the config.php file under /src/

    Code:
    $config['db']['socket'] = null;
     
  7. hazehs

    hazehs Member

    34
    1
    8
    Jul 18, 2020
    Ratings:
    +6
    Local Time:
    2:51 AM
    NGINX 1.18
    MariaDB 10.4
    lol. dont understand this why you need to.

    Which cache are you using ? Can you maybe share your config.php ?
     
  8. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    yeah never had to do that with Xenforo myself so not sure why you'd need to do that