Wordpress Domain Migration

                                                   Wordpress Domain Migration

 

1. Once the LAMP stack (Apache, MariaDB, and PHP) installed and configured on the Ubuntu server, you can proceed further to download the latest version of WordPress using the following wget command.

     #wget -c http://wordpress.org/latest.tar.gz

2. extract the archived file using the tar command as shown.

   #tar -xzvf latest.tar.gz

 

3. Next, move the extracted WordPress directory into your document root i.e. /var/www/html/.

   #ls -l

   #cp -R wordpress /var/www/html/domain.com

 

4. Now set appropriate permissions on the website (/var/www/html/mysite.com) directory. It should      be owned by the Apache2 user and group called www-data.

    #chown -R www-data:www-data /var/www/html/mysite.com

    #chmod -R 775 /var/www/html/mysite.com

 

5. Creating wordpress database for website:-

   #mysql -u root -p

    MariaDB [(none)]> CREATE DATABASE database_name;

    MariaDB [(none)]> GRANT ALL PRIVILEGES ON database_name.* TO 'wordpressuser'@'localhost'          IDENTIFIED BY 'SecureP@ssHere!';

    MariaDB [(none)]> FLUSH PRIVILEGES;

    MariaDB [(none)]> EXIT;

 

6. Next, move into your website’s document root, create a wp-config.php file from the sample              configuration file provided as shown.

    #cd /var/www/html/domain.com

    #cp wp-config-sample.php wp-config.php

 

7. open the wp-config.php configuration file for editing.

    #vi wp-config.php

     

     /** The name of the database for WordPress */

      define('DB_NAME', 'mysql_db_name');

   /** MySQL database username */

      define('DB_USER', 'mysql_user');

  /** MySQL database password */

     define('DB_PASSWORD', 'mysql_user_password');

 

     define('WP_DEBUG', false);

     define('WP_HOME','https://domain.com');    \\when ssl install add this line

     define('WP_SITEURL','https://domain.com');  \\\\when ssl install add this line

    save & quit.

8.     Restart Apache and mysql.

     #systemctl reload apache2

     #service mysql restart

9.  Create Apache Virtualhost for wordpress website:-

    #vi /etc/apache2/sites-available/domain.com.conf

        <VirtualHost *:80>

          ServerName domain.com

          ServerAdmin webmaster@localhost

          DocumentRoot /var/www/html/domain.com

          ErrorLog ${APACHE_LOG_DIR}/error.log

          CustomLog ${APACHE_LOG_DIR}/access.log combined

       </VirtualHost>

      save & quit.

10. Then check the Apache configuration for syntax correctness. If the syntax is OK, enable the new site and reload the apache2 service to apply the new changes.

      # apache2ctl -t

      # sudo a2ensite domain.com.conf

      # sudo systemctl reload apache2

 

11. Also, disable the default virtual host to allow your new site to load properly from a web browser.

     # sudo a2dissite 000-default.conf

     # sudo systemctl reload apache2

 

12. Install ssl certificate for secure connection.

      #apt install certbot python3-certbot-apache

      #certbot --apache

      check the certificate:-

       #Cd /etc/letsencrpt/live

      On this location there will be domain directory present.

 

13. Now configure apache configuration file for port 443:-

     #vi /etc/apache2/sites-available/domain.com-le-ssl-conf

      <IfModule mod_ssl.c>

      <VirtualHost *:443>

      ServerName domain.com

      ServerAdmin webmaster@localhost

      DocumentRoot /var/www/html/wordpress

      ErrorLog ${APACHE_LOG_DIR}/domain.log

      CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/html/wordpress>

        Options Indexes FollowSymLinks

        AllowOverride All

        Require all granted

    </Directory>

    ProxyPass / http://domain:80/

    SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem

    SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem

    Include /etc/letsencrypt/options-ssl-apache.conf

    </VirtualHost>

    </IfModule>

   Save & quit.

 

14. Also do changes in virtualhost of port 80:-

     RewriteEngine on

     RewriteCond %{SERVER_NAME} =domain.com [OR]

     RewriteCond %{SERVER_NAME} =www.domain.com

     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

 

  a. Check for syntax error and reload apache

    #apache2ctl configtest

    #systemctl reload apache2

  b. Also add port 443 in firewall outbound rule.

  c. Enable sites:-

     # a2ensite sktec.conf

     # a2ensite sktec-le-ssl-conf

     # systemctl reload apache2

 

15. Now go to browser open wordpress PhpmyAdmin console.

    a. https://domain.com/PhpMyAdmin

    b. Change domain:-

      i. Click on database>>wp_options>>click on siteurl>>enter new domain name>>save.

      ii. Also click on home>>enter new domain name>>save.

    c. Change admin user password:-

        i. Click on database>>wp_user>>click on edit>>enter new password in password feild>>

           select MD5>>Go.

16. Now Login into wordpress:-

     a. https://domain.com/wp-admin

        i. Go to all pages and change domain name in all pages.

        ii.Also change Title of wordpress site to new domain name.

 

Check marks:- 

Open Browser in Private/Incognito mode, enter public IP provided and search. Website hosted on Server should be opened.   

 

 

  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

New joinee induction checklist

  Induction checklist of New Joinee                 Name of New...

Requirement Gathering

  Whenever we are discussing with client and understanding their needs, few things...

Setup Tally on Cloud

  Hi, Setting up Tally on Cloud is simple task task. Following are steps to follow 1.     Set...

Gaming - setting up server

  Hi, Setting up windows server for gaming is very crucial step when it come to game renderning....

Gaming - order processing

  Once there is an order placed by user for gaming, it will be notified via email and in WHMCS...

Powered by WHMCompleteSolution