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

Installing Wordpress with option 22 after Xenforo 2.2 has been installed

Discussion in 'Blogs & CMS usage' started by JBS, Feb 25, 2021.

  1. JBS

    JBS New Member

    5
    1
    3
    Feb 21, 2021
    Ratings:
    +1
    Local Time:
    3:55 PM
    I have read tons and tons of threads here... but I am still not totally understanding. Is there a way to install Wordpress with option 22 after Xenforo 2.2 has already been installed? My Xenforo runs in domain.com/forums and I would like Wordpress in domain.com.
     
  2. eva2000

    eva2000 Administrator Staff Member

    46,426
    10,551
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,371
    Local Time:
    6:55 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Yeah there isn't a automated way of doing that right now.

    Generally, the best way is to run centmin.sh menu option 22 to install Wordpress first and then do the manual install Xenforo on that Wordpress site's created Nginx vhost config outlined at Centmin Mod Configuration Files - CentminMod.com LEMP Nginx web stack for CentOS which would be at /usr/local/nginx/conf/conf.d/yourdomain.com.com.ssl.conf if you are using HTTPS.

    If you already installed Xenforo and don't want to reinstall again, you can create a Wordpress install via centmin.sh menu option 22 on a dummy subdomain site i.e. sub.yourdomain.com and then using same procedure at Wordpress - centmin.sh menu option 22 - How to switch Wordpress to subdirectory move sub.yourdomain.com installed Wordpress files at /home/nginx/domains/sub.yourdomain.com/public to your Xenforo yourdomain.com public web root at /home/nginx/domains/yourdomain.com/public - though is whether files are overwritten between the 2 sites but if you have installed forums at yourdomain.com/forums then should be fine to just move files.

    1. log into Wordpress sub.yourdomain.com install and set default home/url domain for Wordpress to yourdomain.com
    2. then copy over files using the command below to unalias cp command with backslash and use a (archive) and f flags (force) will overwrite files on destination if conflict occurs. Unalias removes the default CentOS 7 alias command for cp which is cp -i which prompts to ask if you want to overwrite the file(s).
    Code (Text):
    alias | grep cp 
    alias cp='cp -i'
    

    Code (Text):
    cp --help
    Usage: cp [OPTION]... [-T] SOURCE DEST
      or:  cp [OPTION]... SOURCE... DIRECTORY
      or:  cp [OPTION]... -t DIRECTORY SOURCE...
    Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
    Mandatory arguments to long options are mandatory for short options too.
      -a, --archive                same as -dR --preserve=all
          --attributes-only        don't copy the file data, just the attributes
          --backup[=CONTROL]       make a backup of each existing destination file
      -b                           like --backup but does not accept an argument
          --copy-contents          copy contents of special files when recursive
      -d                           same as --no-dereference --preserve=links
      -f, --force                  if an existing destination file cannot be
                                     opened, remove it and try again (this option
                                     is ignored when the -n option is also used)
      -i, --interactive            prompt before overwrite (overrides a previous -n
                                      option)
      -H                           follow command-line symbolic links in SOURCE
      -l, --link                   hard link files instead of copying
      -L, --dereference            always follow symbolic links in SOURCE
      -n, --no-clobber             do not overwrite an existing file (overrides
                                     a previous -i option)
      -P, --no-dereference         never follow symbolic links in SOURCE
      -p                           same as --preserve=mode,ownership,timestamps
          --preserve[=ATTR_LIST]   preserve the specified attributes (default:
                                     mode,ownership,timestamps), if possible
                                     additional attributes: context, links, xattr,
                                     all
      -c                           deprecated, same as --preserve=context
          --no-preserve=ATTR_LIST  don't preserve the specified attributes
          --parents                use full source file name under DIRECTORY
      -R, -r, --recursive          copy directories recursively
          --reflink[=WHEN]         control clone/CoW copies. See below
          --remove-destination     remove each existing destination file before
                                     attempting to open it (contrast with --force)
          --sparse=WHEN            control creation of sparse files. See below
          --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                                     argument
      -s, --symbolic-link          make symbolic links instead of copying
      -S, --suffix=SUFFIX          override the usual backup suffix
      -t, --target-directory=DIRECTORY  copy all SOURCE arguments into DIRECTORY
      -T, --no-target-directory    treat DEST as a normal file
      -u, --update                 copy only when the SOURCE file is newer
                                     than the destination file or when the
                                     destination file is missing
      -v, --verbose                explain what is being done
      -x, --one-file-system        stay on this file system
      -Z                           set SELinux security context of destination
                                     file to default type
          --context[=CTX]          like -Z, or if CTX is specified then set the
                                     SELinux or SMACK security context to CTX
          --help     display this help and exit
          --version  output version information and exit
    


    the SSH command to copy all Wordpress installed files in /home/nginx/domains/sub.yourdomain.com/public/ to /home/nginx/domains/yourdomain.com/public

    Code (Text):
    \cp -af /home/nginx/domains/sub.yourdomain.com/public/* /home/nginx/domains/yourdomain.com/public


    3. Then modify centmin.sh menu option 22 auto generated cronjob for auto updates at /root/tools/wp_updater_sub.yourdomain.com.sh using a sed replacement command by filling in variables below (type into SSH client)
    Code (Text):
    old=sub.yourdomain.com
    new=yourdomain.com
    sed -i "s|$old|$new|g" /root/tools/wp_updater_sub.yourdomain.com.sh
    


    4. Then just a matter of copying and transplanting your sub.yourdomain.com Nginx vhost config settings unique for Wordpress at /usr/local/nginx/conf/conf.d/sub.yourdomain.com.com.ssl.conf to your Xenforo Nginx vhost at /usr/local/nginx/conf/conf.d/yourdomain.com.com.ssl.conf

    5. Then eventually test nginx config and restart nginx
    Code (Text):
    nginx -t
    ngxrestart


    As per Guide to learning more about Centmin Mod, best way to do this is do a test hourly VPS or test install i.e. on dummy yourdomain2.com install a dummy Xenforo install and then do a centmin.sh menu option 22 on sub.yourdomain2.com and try above steps. Once comfortable with process, you can do it on live Xenforo install and Wordpress. That usually how I learn and do things - do on test install first before live :)
     
  3. JBS

    JBS New Member

    5
    1
    3
    Feb 21, 2021
    Ratings:
    +1
    Local Time:
    3:55 PM
    Thanks for your help. I'm struggling with this one. I can't see to figure out what to transplant.
     
  4. eva2000

    eva2000 Administrator Staff Member

    46,426
    10,551
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,371
    Local Time:
    6:55 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Which cache method did you select ? For Cache Enabler cache method, and example Nginx vhost for yourdomain.com at centmin.sh menu option 22 wordpress yourdomain.com 123.09beta01 28/02/21, the following would be transplanted to Xenforo domain.com - changing yourdomain.com to your Wordpress subdomain references
    Code (Text):
      include /usr/local/nginx/conf/wpincludes/yourdomain.com/wpcacheenabler_yourdomain.com.conf;
      #include /usr/local/nginx/conf/wpincludes/yourdomain.com/wpsupercache_yourdomain.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/yourdomain.com/rediscache_yourdomain.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
     
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri_webp $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        #auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/yourdomain.com/htpasswd_wplogin;  
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://jetpack.com/support/hosting-faq/
        include /usr/local/nginx/conf/jetpack_whitelist_ip.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-scripts\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-styles\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/yourdomain.com/wpsecure_yourdomain.com.conf;
    

    where first location / {} context is actually replacing your Xenforo domain's nginx vhost
    Code (Text):
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri_webp $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    


    be sure to backup both your xenforo and Wordpress nginx vhost config files before modifying them ;)
     
  5. JBS

    JBS New Member

    5
    1
    3
    Feb 21, 2021
    Ratings:
    +1
    Local Time:
    3:55 PM
    @eva2000 Thank you very much... this has been awesome! Site is really cranking now compared to what it was.

    Do you have a donation widget on here somewhere so I can buy you a beer?

    EDIT: Never mind... found it... donated! I'm clearly not paying attention.
     
    Last edited: Mar 9, 2021
  6. eva2000

    eva2000 Administrator Staff Member

    46,426
    10,551
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,371
    Local Time:
    6:55 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Glad to hear to worked and your site is much faster :D

    Thanks for the donation (y)