×

Host Wordpress Website In GCP

Host Wordpress Website In GCP

Host Wordpress Website In GCP

Step 1: Create an Instance.

Step 2: Install Apache server,PHP,MySql on Instance.

a)Install Apache and PHP:

  1. sudo yum check-update

  2. sudo yum -y install httpd php

b)Start the Apache service:

  1. sudo service httpd start

  2. sudo chkconfig httpd on

Step 3: Test Apache

  1. For this step, you need the external IP address of your instance. You can look up the address in the VM Instances page in the Cloud Platform Console.

  2. In a browser, enter your external IP address to verify that Apache is running:

  3. http://[YOUR_EXTERNAL_IP_ADDRESS]

  4. You should see the Apache test page.

Step 4: Install MySQL on your instance

Install MySQL and related PHP components:

  1. Install MySQL and related components:

  2. sudo yum -y install httpd mysql-server php php-mysql

  3. Start the MySQL service

a)sudo service mysqld start

b)sudo mysql_secure_installation (Configure MySQL)

Step 5: Configure the httpd.conf file.(/etc/httpd/conf/httpd.conf).

Step 6: Add Virtual host at the end of httpd.conf file.


<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/[Project folder]
    ServerName www.example.com
    ServerAlias example.com
#     ErrorLog /var/www/example.com/error.log
#     CustomLog /var/www/example.com/requests.log
</VirtualHost>


Step 7: Comment out all line of welcome.conf file (/etc/httpd/conf.d/welcome.conf)


Migration:


Step 1: Copy project file to /var/www/html/


Step 2: Create Database on Instance (create database database_name;)

Step 3: Import database file to project explicitly (mysql -u root -p database_name<dump.sql)

Step 4: Restart httpd and mysql.

Step 5: You need to modify siteurl and home value to IP address of an Instance through SQL query. Siteurl and Home attributes are present on wp_options table.





Trendy