<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress &#8211; Zhijun Chen</title>
	<atom:link href="https://zhijunchen.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>https://zhijunchen.com</link>
	<description></description>
	<lastBuildDate>Fri, 07 Jun 2024 06:32:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.4</generator>

<image>
	<url>https://zhijunchen.com/wp-content/uploads/2021/03/cropped-my-site-icon-1-32x32.png</url>
	<title>WordPress &#8211; Zhijun Chen</title>
	<link>https://zhijunchen.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Creating WordPress Site on Google Cloud Platform with Free SSL Certificates</title>
		<link>https://zhijunchen.com/creating-wordpress-site-on-google-cloud-platform-with-free-ssl-certificates/</link>
		
		<dc:creator><![CDATA[Zhijun Chen]]></dc:creator>
		<pubDate>Wed, 31 Mar 2021 20:03:04 +0000</pubDate>
				<category><![CDATA[Website]]></category>
		<category><![CDATA[Google Cloud Platform]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://zhijunchen.com/?p=27</guid>

					<description><![CDATA[It&#8217;s always nice to have a blog to capture what you&#8217;ve done over time. After researching around I eventually went with Google Cloud WordPress Click to Deploy for my blog website because Google offers $300 free trial and it is fairly easy to setup. I also need to secure my website with SSL/HTTPS so I [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s always nice to have a blog to capture what you&#8217;ve done over time. After researching around I eventually went with Google Cloud WordPress Click to Deploy for my blog website because <a rel="noreferrer noopener" href="https://cloud.google.com/free/docs/gcp-free-tier" data-type="URL" data-id="https://cloud.google.com/free/docs/gcp-free-tier" target="_blank">Google offers $300 free trial</a> and it is fairly easy to setup. I also need to secure my website with SSL/HTTPS so I went with <a rel="noreferrer noopener" href="https://letsencrypt.org/" target="_blank">Let&#8217;s Encrypt</a> as it is free. To make sure that I don&#8217;t need to manually renew certificates (the virtue of being lazy 😉 ), I also set up a cron job to renew certificates automatically. Let&#8217;s see how all these were set up! </p>



<h2 class="wp-block-heading">Create WordPress on Google Cloud Platform</h2>



<p>The first step would be creating the site on Google Cloud. Once you&#8217;ve signed up for Google Cloud, go to <a rel="noreferrer noopener" href="https://console.cloud.google.com/" target="_blank">Google Cloud Console</a> and create a new project from <a rel="noreferrer noopener" href="https://console.cloud.google.com/cloud-resource-manager" target="_blank">Manage Resources</a> page. After project creation, click on <strong><em>Marketplace</em></strong> and search for <strong><em>WordPress</em></strong>.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="572" src="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-1024x572.png" alt="" class="wp-image-45" srcset="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-1024x572.png 1024w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-300x168.png 300w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-768x429.png 768w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-1536x858.png 1536w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-17.50.10-2048x1144.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Select highlighted item and click <strong>LAUNCH</strong> button. That will open the following page. Select the zone and machine type (If you want to use Free Tier, select <strong>micro</strong>). Enter Administrator e-mail address. On Firewall section, check both allow HTTP and HTTPS traffic.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="573" src="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-1024x573.png" alt="" class="wp-image-48" srcset="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-1024x573.png 1024w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-300x168.png 300w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-768x429.png 768w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-1536x859.png 1536w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-18.00.10-2048x1145.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Scroll down and click <strong>Deploy</strong>. </p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="705" src="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-19.09.59-1024x705.png" alt="" class="wp-image-49" srcset="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-19.09.59-1024x705.png 1024w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-19.09.59-300x207.png 300w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-19.09.59-768x529.png 768w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-19.09.59.png 1212w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Open the site address and you should be able to see your website running. 🚀</p>



<h2 class="wp-block-heading">Update Domain Details</h2>



<p>Once you have the website running, the next step is to update your domain DNS settings with IP address shown on site address. Most domain registry service would allow you to manage DNS distribution. I used <a rel="noreferrer noopener" href="https://www.namecheap.com/" target="_blank">Namecheap</a> and this is what it looks like.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="525" src="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-1024x525.png" alt="" class="wp-image-52" srcset="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-1024x525.png 1024w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-300x154.png 300w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-768x394.png 768w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-1536x787.png 1536w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.22.49-2048x1049.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>You need to create two <strong>A Record</strong>s with <strong>@</strong> and <strong>www</strong> and point them to your IP address from Google Cloud Platform.</p>



<p>After domain is propagated (Check with <a rel="noreferrer noopener" href="https://dnschecker.org/" target="_blank">DNSChecker</a>), you should be able to view your website with domain name.</p>



<h2 class="wp-block-heading">Update WordPress Address</h2>



<p>Once domain is propagated, you need to update it in WordPress.</p>



<p>Go to <strong>Settings</strong> -&gt; <strong>General</strong>, and update <strong>WordPress Address</strong> and <strong>Site Address</strong> with <strong>http://&lt;youdomainname</strong>&gt;.</p>



<p>After this is updated, you will need to re-login again.</p>



<h2 class="wp-block-heading">Configure Let&#8217;s Encrypt SSL Certificate</h2>



<p>Up to this point your website is up and running, but if you visit your site you will notice a warning on the address bar saying that your site is insecure. The next step would be adding SSL certificate to your website. We will use <a rel="noreferrer noopener" href="https://letsencrypt.org/" target="_blank">Let&#8217;s Encrypt</a> and <a rel="noreferrer noopener" href="https://certbot.eff.org/" target="_blank">Certbot</a> for this.</p>



<p>First of all go to <strong>Deployment Manager </strong>and click on <strong>SSH</strong> to launch terminal.</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="589" data-id="53" src="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.40.57-1024x589.png" alt="" class="wp-image-53" srcset="https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.40.57-1024x589.png 1024w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.40.57-300x173.png 300w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.40.57-768x442.png 768w, https://zhijunchen.com/wp-content/uploads/2021/03/Screenshot-2021-03-31-at-20.40.57.png 1201w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</figure>



<p>This will open a terminal in a new window. Then run the following command to install certbot (Make sure you are under Debian system).</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo apt-get install certbot python-certbot-apache -t stretch-backports</code></pre>



<p>After all packages are installed, run the following command, which should guide you through certificate generation</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo certbot --apache</code></pre>



<ol>
<li>Enter email address</li>



<li>Agree to Terms of Service</li>



<li>Select whether you want to share your email address, I chose <strong>No</strong></li>



<li>For inputting the domain names: <strong>Type in both your @ and www addresses</strong>. In my case they are zhijunchen.com and www.zhijunchen.com</li>



<li>Enter <strong>2 </strong>for virtual host selection, the one with your domain name and HTTPS.</li>



<li>Select <strong>Redirect </strong>to make all HTTP request directed to HTTPS.</li>
</ol>



<p>After everything is set up, you need to run the following command to restart Apache server for certificate changes to take effect.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo service apache2 restart</code></pre>



<p>Not navigate to https://yourdomainname and you should see the padlock indicating your website is secure.</p>



<h2 class="wp-block-heading">Update WordPress Address with HTTPS</h2>



<p>You will need to update WordPress address again with https protocol.</p>



<h2 class="wp-block-heading">SSL Certificates Auto-Renewal</h2>



<p>By default the certificate will last for about 3 months and you will need to renew it once expired. You can set this up automatically using the following command:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo crontab -e</code></pre>



<p>If you are asked for editor choice, select VIM Basic.</p>



<p>This will open your cron jobs and you will add the following line to the document.</p>



<pre class="wp-block-code"><code class="">0 */12 * * * certbot -q renew --apache</code></pre>



<p>This will run the renew process twice daily and auto renewing certificates if expired.</p>



<p>Hope you enjoy this! 😄</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
