One Page Zen

Web Design. Simplified.

  • Tutorials
    • Google Cloud
    • Amazon Cloud
    • Microsoft Cloud
  • Start
  • Resources

Add Expires Headers for WordPress on Google Cloud (Bitnami)

November 11, 2020 Leron Amin 109 Comments

FacebookTweetLinkedInEmail

Adding Expires and Cache-control headers is a great way to improve user experience by reducing your website’s load time.

In this tutorial you will learn how to quickly add Expires and Cache-control headers to your WordPress Bitnami installation.

Configuring Expires and Cache-control headers enables your website to cache static content, leading to better website performance and reduced load times for visitors.

Checking existing headers

Before diving into this tutorial, you should check your website for existing Expires and Cache-control headers. To do this, run a test for your domain at GTMetrix.com.

add expires headers wordpress on google cloud bitnami
After running a performance report for my domain on GTMetrix.com, it was clear that my server did not have Expires/Cache-control headers configured, as the test responded with a failing grade.

If you received an F grade for the Add Expires Headers recommendation, then read on to learn how to configure Expires and Cache-control headers for your website.

Getting started

Before getting started with this tutorial, you should have already installed the Bitnami WordPress (LAMP) stack on Google Cloud. If you haven’t yet done this, check out the following tutorials for instructions on how to install the Bitnami WordPress stack on Google Cloud.

Please note that this tutorial will also work with the Bitnami WordPress (LAMP) stack on Amazon AWS and Microsoft Azure.

Lastly, if you’ve already configured Expires Headers as shown in step 4 of the CloudFlare CDN for WordPress on Google Cloud tutorial, then you can skip this tutorial.

There are 5 steps in this tutorial:

  • 1. Connect to your instance
  • 2. Enable expires_module
  • 3. Add expires headers
  • 4. Restart Apache server
  • 5. Test performance

1. Connect to your instance

add expires headers for wordpress bitnami ssh into vm instance
From your Google Cloud dashboard, navigate to VM instances, and click the SSH button next to the virtual machine instance that is running your WordPress website.
If you are using AWS, click here for instructions on how to SSH into your EC2 instance.

2. Enable expires module

add expires headers for wordpress bitnami open httpd.conf file
After connecting to your virtual machine instance, run the command below to open your Apache server configuration file.
sudo nano /opt/bitnami/apache2/conf/httpd.conf
add expires headers wordpress google cloud
At the top right corner of the page, click on the keyboard icon, then select Ctrl+W to search.
add expires headers wordpress google cloud bitnami
After the search field opens, type expires then press Enter to search.
add expires headers wordpress on google cloud bitnami
Remove the # symbol from next to the expires_module in order to activate it.
Lastly, enter CRTL + X, then Y, to save and exit the file.

3. Add expires headers

add expires headers for wordpress on google cloud bitnami
Enter the command below to open your Apache server application configuration file.
sudo nano /opt/bitnami/apps/wordpress/conf/httpd-app.conf
add expires wordpress on google cloud bitnami
After opening your httpd-app.conf file, copy and paste the code below directly above the line that starts with . Lastly, enter CRTL + X, then Y, to save and exit the file.

<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>

4. Restart Apache server

add expires headers wordpress on google cloud bitnami
Execute the command below to restart your Apache server.
sudo /opt/bitnami/ctlscript.sh restart

5. Test performance

Now that you’ve configure Expires and Cache-control headers for your WordPress website, the next step is to test that the changes were effective. Re-test your domain on GTMetrix.com to get an updated performance report, then navigate to the YSlow tab.

add expires headers wordpress on google cloud
If you configured your Expires and Cache-control headers correctly, you will receive a passing grade for the Add Expires Headers recommendation.
add expires headers wordpress on google cloud bitnami
You can optionally click on the YSlow tab to view the exact details of your Expires and Cache-control headers.

Frequently Asked Questions

  1. Why do you need Expires and Cache-control headers?
  2. According to Kartik Ayyar, Machine Learning engineer at Google, you should “use both, primarily because different browsers and intermediate proxies can implement parsing these headers slightly differently and you want to insulate yourself from bugs in either”.

  3. How do you check if both Expires and Cache-control headers are enabled?
  4. You can view your Expires and Cache control settings by running a performance report for your website on GTMetrix.com, then clicking on one of your website’s images under the Waterfall tab.

    add expires headers wordpress on google cloud bitnami
    If you’ve successfully followed this tutorial, you will notice that your server will respond with both Expires and Cache-control headers
    add expires headers wordpress on google cloud bitnami
    If you enabled either Expires or Cache-control headers, but not both, then you will see only one of the response headers appear in the Waterfall tab (notice how an Expires header does not appear in the Waterfall chart in the image above).

Troubleshooting

If you have any questions or comments regarding this tutorial, please leave them in the comment field below.

For troubleshooting support, be sure to check out the WordPress Cloud Hosting Support Group on Facebook.

Related Posts

  • How to Access phpMyAdmin via SSH Tunnel (GCP)
  • How to Migrate WordPress Installations
  • Free SSL Certificate Setup for WordPress on Google Cloud (Bitnami)
  • Manage WordPress Files on Google Cloud Platform
  • Get Started with WordPress on Google Cloud Platform
  • Configure 301 Redirects for Websites on Google Cloud (Apache)
FacebookTweetLinkedInEmail

Filed Under: Featured, GCP WordPress, Google Cloud Platform Tagged With: aws, azure, caching, ec2, expires headers, gcp, google cloud

Comments

  1. Nickie Oakwood says

    June 29, 2020 at 3:21 pm

    Tried it but my conf looked different plus in the explanation can not see the dot. Anyway tried it and got 521 error. So reverted conf back and site back.

    RewriteEngine On
    RewriteRule / / [L,R]

    Options +MultiViews +FollowSymLinks
    AllowOverride None
    <IfVersion
    Order allow,deny
    Allow from all

    = 2.3>
    Require all granted

    Header set Cache-Control “max-age=2592000, public”

    php_value memory_limit 512M

    Reply
  2. Nickie Oakwood says

    June 21, 2020 at 3:45 pm

    Sadly didn’t change on GT Metrix for me.

    Reply
  3. Jame Petchin says

    June 17, 2020 at 4:36 pm

    I got rid of the expire header problem, but now a new problem came up “Avoid landing page redirects” tried so many options but I still get this fault. I believe this forum is the best place I can get the final answer to this problem. Please do help me out on this one.

    Reply
    • Leron Amin says

      June 21, 2020 at 7:58 pm

      Hi Jame,

      You’re bound to see this message depending on the preferred version of your domain. It’s not a problem – it’s simply notifying you that a redirect took place.

      If your preferred domain is without the www. prefix, and you run a GTMetrix test for your domain with the www. prefix, there will be a redirect – and vise versa – there’s no way around around this. As a best practice, set your preferred domain to the non-www. version, as most users will access your site without the www. prefix, thereby reducing the number of visitors who will encounter the landing page redirect.

      Use GTMetrix as a guide/reference point towards improving the general performance of your application, and don’t focus as much on the letter score.

      Let me know if you have any questions,
      Joe

  4. Devansh Chaudhary says

    May 22, 2020 at 2:22 am

    Thanks for this awesome tutorial.
    https://gtmetrix.com/reports/www.spactual.com/RE4az50h
    There are still many google fonts and other google links in expire header. How to fix them.

    Reply
  5. David Robinson says

    April 12, 2020 at 1:10 am

    Thank you for this awesome post!

    I have a question, if I set expires headers to my e-commerce website where I frequently add and remove products and changing images in the store.

    Will it affect my client-side in terms of getting these updates?

    Reply
    • Leron Amin says

      April 20, 2020 at 8:53 pm

      Hi David,

      Yes, that’s correct. With e-commerce, you’ll have to be more strategic about your cache-control settings.

      Take a look at this article about the SEO implications of expires headers, and this article about invalidating and updating cached responses (which ties into your question about client-side updating).

      Please reach out if you have other questions,
      Joe

  6. Shahbaaz says

    February 20, 2020 at 2:20 pm

    Hi, I followed your tutorial extensively but my GT matrix score is still the same. I am getting 0 on add expires headers. What should I do ?

    Here is a Screenshot of the same https://ibb.co/9Hqq2Jc

    Reply
    • Leron Amin says

      February 24, 2020 at 12:15 pm

      Hi Shahbaaz,

      Did you restart your server after making the changes? Did you clear your cache (if using a caching plugin).

      Talk to you soon,
      Joe

  7. Jitu Tripathi says

    November 30, 2019 at 11:37 am

    I follow your tutorial . I have a bitnami wordpress website on Google cloud platform but i have a question which which cache plugins are good for my web . And which cache plugins you used in one page zen. Pls tell me

    Reply
    • Leron Amin says

      December 20, 2019 at 8:24 pm

      Hi Jitu,

      Bitnami has documentation on how to optimize your WordPress website’s performance, which you can view here.

      Let me know if you have any questions,
      Joe

  8. Rade says

    October 23, 2019 at 4:26 am

    Hello,

    I followed the instructions but did not change the Gt metrix report and also I continued to see Get header.jpg in my waterfall chart.
    I am using Cloudflare, and I changed the setting to Respect Existing Headers. Allso, I am using the plugins Autoptimize and ShortPixel Image Optimizer, and I tried without them but no change in the GTmetrix.
    Is there anything else I must to do?
    I tried this on a site where only wordpress was installed, and there was no problem, Expires Headers was created.

    Thanks.

    Reply
    • Leron Amin says

      October 25, 2019 at 6:14 pm

      Hi Rade,

      If you’re using CloudFlare, then you’ll have to configure the caching settings from within the Cloudflare dashboard. For additional information about this process, check out step 4 of the Cloudflare tutorial.

      Hope this helps and let me know if you have questions about this process.

      Talk to you soon,
      Joe

    • Rade says

      October 26, 2019 at 8:35 am

      Hi Joe,

      Thanks for your reply.
      I have already done it by following your instructions. But still Express Headers was not created. How can I determine what the problem is?

      Thanks.

    • Leron Amin says

      November 9, 2019 at 3:40 pm

      Hi Rade,

      You will have to do some research into the issue in order to determine why Cloudflare isn’t respecting your existing headers, or vise versa.

      Configuring Cloudflare for your website has many benefits, but it also adds a layer of complexity.

      I’d recommend you try configuring the headers through Cloudflare – does that work?

      Talk to you soon,
      Joe

  9. Mohsin says

    September 1, 2019 at 2:37 am

    Hi
    i am not using bitnami how can i do that with (Linux wordpress-1-vm)
    pls share the commands

    Reply
    • Leron Amin says

      September 10, 2019 at 10:13 am

      Hi Mohsin,

      If you’re using Apache, you can add the directives to either an htaccess file or your default server configuration file.

      Hope this helps and let me know if you have questions,
      Joe

  10. Steve Goglewski says

    August 26, 2019 at 12:18 pm

    I am with all the rest please show this for one click install. I also wanted to try the the google load balancer & Cdn combo. Everyone else makes it super complicated or assumes we are already familar with the interface and configuration. LOVE these videos.

    Reply
    • Leron Amin says

      August 26, 2019 at 7:15 pm

      Thanks for the feedback Steve – I will publish this tutorial, as many people have been requesting it recently.

  11. Gintautas Bruzas says

    August 25, 2019 at 10:11 am

    Hello,

    Thanks to you guys, omg you saved me so much time already!
    Bu i have big bad issue with SVG and WOFF files, even I add a lines for them it seems it doesnt work 🙁

    So sad… but maybe you guys know were is the problme?

    Thanks!

    Reply
  12. Preeti says

    August 18, 2019 at 5:18 am

    will you please share the process of add expire headers in wordpress google deploy. not for wordpress bitnami.

    Reply
    • Leron Amin says

      August 20, 2019 at 6:07 pm

      Yes, I will create this tutorial – thank you for the suggestion!

  13. Hussain Vohra says

    July 13, 2019 at 1:34 am

    Your tutorials are very good.

    Please create a tutorials for adding Expire Headers for One-Click WordPress Install in GCP. Thanks You.

    Reply
    • Leron Amin says

      July 24, 2019 at 6:48 pm

      Will do – thanks for the suggestion Hussain!

    • Vikash Goyal says

      July 24, 2020 at 6:47 am

      Did he make the tutorial for One Click WordPress GCP- I also need it. Great work man…!!

  14. yavar khan says

    July 3, 2019 at 5:01 am

    I did the above steps but it does not apply to the below


    https://www.googletagmanager.com/gtag/js?id=UA-87254826-1
    https://connect.facebook.net/en_US/fbevents.js
    https://fonts.googleapis.com/css?family=Sintony:normal%7CMonda:700&subset=latin,latin
    https://connect.facebook.net/signals/config/1978088205577631?v=2.8.51&r=stable
    https://www.google-analytics.com/analytics.js
    https://connect.facebook.net/signals/plugins/inferredEvents.js?v=2.8.51

    Reply
    • Leron Amin says

      July 8, 2019 at 4:48 pm

      Hi Yavar,

      Those are external scripts, so you don’t have any control over their expiration. That being said, you can download the font if you’d like to serve it from your own domain instead of from googleapis – this would allow to you to define the expires headers.

      Let me know if you have questions,
      Joe

    • yavar khan says

      July 9, 2019 at 3:20 am

      Awesome thx

  15. Kartik says

    June 29, 2019 at 6:14 am

    Your tutorials are really great.

    But Could you please please make a tutorial on How to configure WordPress (Click to Deploy) for all Cache Plugins and other plugins.

    Because its always gives some type of error.

    Thanks in advance.

    Reply
    • Leron Amin says

      July 8, 2019 at 5:26 pm

      Thank you for the recommendation Kartik – this is something I will look into!

  16. Benjamin Waller says

    June 13, 2019 at 2:39 am

    Hello Joe,

    As always you do a fantastic job with helping people understand cloud computing. Such a great resource.

    I have a question, after adding expires headers to my WP site I still get a F (failing) score. It looks like most of them are Goodle fonts but there is one background image which is a .jpg which is listed so maybe adding the expires headers hasn’t worked correcly?
    See the GT Metrixs report.
    https://gtmetrix.com/reports/www.jonaviray.com/GL6E73mF

    Cheers,
    Ben

    Reply
    • Leron Amin says

      June 17, 2019 at 5:39 pm

      Thanks for the feedback Ben!

      You would need to download and serve the external resources from your own domain if you wanted to configure cache-control headers for that content. I’m not sure about the issue with the jpeg image not caching properly. Did you restart your Apache server after making the changes?

      You can also check the existing cache control-headers by following the instructions from this guide, which has instructions for Chrome devtools.

      You can also copy the link to whichever image you want to check the headers on, then use the curl command according to the following model:

      curl -I https://www.myimage.com/exampleimage.png

      Also – if you’re using Cloudflare – make sure the ‘Respect Existing Headers’ setting is selected under your ‘Browser Cache Expiration’ settings. I go over this in step 4 of the Cloudflare tutorial.

      Let me know if you’re able to get the issue resolved,
      Joe

      Let me know if you’re able to resolve the issue!

      Talk to you soon,
      Joe

  17. Muhammad Waleed says

    March 10, 2019 at 12:46 am

    Hello Bro this was a really helpful tutorial but the problem is that I have deployed the Click to Deploy version of wordpress on my GCP VM instance so can you plzz make a tutorial for the Click to Deploy version, it would be a great help.

    Reply
    • Leron Amin says

      March 18, 2019 at 7:29 pm

      Hi Muhammad – this is on my list of tutorials to do! Thanks for the feedback and suggestion!

  18. Gary Watson says

    March 1, 2019 at 2:12 pm

    Love your blog, so helpful with issues that keep arising for me as a freelancer and i keep reverting back here for the solution. Hands down class lad

    Reply
    • Leron Amin says

      March 2, 2019 at 4:27 pm

      Thanks for sharing your feedback – I’m glad to hear the tutorials have been helpful to you!

  19. Sejarah Negara says

    February 2, 2019 at 12:27 am

    I was very happy with your tutorial from the first time I tried to build the site, so I could make it. I am very happy.

    When I applied this tutorial, I suspected that something was not right. In Gtmetrix it says:

    Cache-Control: max-age = 0, no-cache, s-maxage = 10

    Where is my mistake?

    Regards

    Reply
    • Leron Amin says

      February 2, 2019 at 7:17 pm

      Hi Sejarah,

      I’m not sure what your mistake is. Make sure that you saved the file in Nano after editing it. Also, I’d recommend going through the tutorial again to ensure that you didn’t miss any steps.

      Let me know if you have any questions,

      Joe

  20. Garrett Dewbre says

    January 16, 2019 at 7:38 pm

    Does this tutorial work for the standard Bitnami Google Cloud deployment? Or, is this only applicable for Bitnami LAMP Stack?

    Also, when I decide to begin using a CDN, will the changes made in this tutorial effect the use of a future CDN?

    Thanks,
    Garrett

    Reply
    • Leron Amin says

      January 19, 2019 at 1:44 pm

      Hi Garrett,

      This only works for the Bitnami LAMP stack.

      Regarding the CDN question: you can either configure your CDN to respect the existing headers, or create new ones – it just depends on your CDN configuration.

      Talk to you soon,
      Joe

  21. Sergio says

    January 7, 2019 at 3:41 am

    Hello Leron,

    Once again thank you for the great tutorial, I built my first website using your tutorials from the beginning. Have two questions please:

    1* On the “Expires Headers” code, did you forget to insert this line or it was intentional?
    LINE: ExpiresByType text/html “access 1 month”

    2*. On GTmetrix and precisely on the “Add Expires headers” section I still get a message regarding some components without a far-future expiration date (Analytics):
    https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX
    https://www.google-analytics.com/analytics.js

    Is there any tweak to apply the Expires on the analytics code?

    Thanks again and keep the good work.
    Sergio, SEO Expert.

    Reply
    • Leron Amin says

      January 8, 2019 at 5:44 pm

      Hi Sergio,

      I’m glad you’ve enjoyed the tutorials!

      Yes – I would recommend adding the text/html header. And don’t add an expires header for Google Analytics – Philip Watson gives a good explanation of the reasons not to here. I wouldn’t worry too much about Tag Manager either; the idea behind adding expires/cache-control headers is to minimize HTTP requests. Most websites make anywhere from 50-200 requests, and anything above 100 seems to really impact performance, so I wouldn’t worry about an additional one or two. Your time is better spent optimizing your website’s media either through compression or through optimizing content delivery.

      Hope this helps and let me know if you have questions,
      Joe

    • Sergio says

      January 9, 2019 at 3:41 am

      Thank you Joe, here are my stats on GTmetrix:
      https://snag.gy/R8Vp4z.jpg

      I’ll pass on the minimizing requests process for now, because I think my website is already optimized in this area.

      Just an other question: how do you recommend optimizing content delivery?

    • Leron Amin says

      January 10, 2019 at 8:32 pm

      Hi Sergio,

      There are many options when it comes to implementing a content delivery network, but the easiest would be to setup Cloudflare CDN: free CDN, great security features, and some other fairly advanced features. You can also look at more conventional CDN’s; I know that most of the big CDN providers have plugins for easy WordPress integration.

      Another solution is to serve static assets (videos, images) from a multi-regional storage bucket. This can be done fairly easily thanks to the WP-Stateless plugin. This is a cost-effective solution that would be optimal for a media-rich WordPress websites (photography, graphic design, etc.).

      Another possibility is deploying multiple identical instances in areas where your visitors are centered, then using a cross-region load balancer (here’s a tutorial) to forward traffic to the instances in the various regions. This is optimal for website with a global audience, for instance a 50/50 distribution of traffic from the United States and India would call for deploying instances in both of those countries in order make your website’s content more readily available to users. Keep in mind that this solution is resource intensive, due to both it’s complexity and high cost.

      Hope this answers your question!
      Joe

    • Sergio says

      January 11, 2019 at 7:10 am

      Thank you Joe, this answers all of my questions and more, looking forward for the next video/article.
      Keep up the good work.

    • Leron Amin says

      January 15, 2019 at 7:14 pm

      Thanks for the feedback Sergio! 🙂

  22. louisa says

    January 5, 2019 at 1:07 pm

    Is there a way to measure the contents of a blog to see how much memory the blog is using? Google Cloud offers different types of VMS, with the smallest one being f1-micro 0.6GB. You said this is sufficient for small to medium blogs. I was wondering if it’s possible to track the size of my blog so I know when to upgrade to a bigger VM if needed.

    Reply
    • Leron Amin says

      January 8, 2019 at 5:56 pm

      Hi Louisa,

      You can navigate to Compute Engine > VM Instances, then click on the instance that’s running your website. From there, click on the ‘Monitoring’ tab at the top of the page. The resulting graphs will provide you with a 30-day insight into how your VM is performing, and whether it’s being over or under utilized.

      To check available disk space, SSH into your instance and type the following command: df. This will give you insight into whether or not you need to add more storage. If your VM is short on storage, you will notice a significant decrease in performance.

      Hope this helps, and let me know if you have questions,
      Joe

    • louisa says

      January 11, 2019 at 7:03 pm

      In Monitoring, the graph for 30 days for %CPU shows under 5%. Does this mean only less than 5% of the VM is being used? I have a few more questions.

      1) At what percentage %CPU usage should I consider scaling up to a bigger VM?

      2) I followed your tutorials on how to set up a blog in Google Cloud and managed to do it even though I know next to nothing about cloud computing (thanks so much!!!). Originally I chose the smallest VM with 0.6GB RAM, which costs about $5/month. I thought the site would run faster if I scale up so I changed to a bigger VM, n1-standard-1 with 3.75GB. Is it possible for me to go down back to 0.6GB since I don’t need a big VM like the one I have now? Can I just stop the VM, choose the 0.6BG option and restart the VM again?

    • Leron Amin says

      January 15, 2019 at 7:11 pm

      Hi Louisa,

      Thanks for the great feedback – I’m glad the tutorials have been helpful to you!

      And yes – your machine type is overkill considering the size of your application. There’s nothing wrong with this, it just means that you’re paying for resources that your project isn’t using.

      Additionally, the added CPU power won’t have a huge impact on your website’s performance because your visitor’s connection speed is already the limiting factor. Instead, consider upgrading the memory from 0.6 to 1.7GB. Keep in mind that WordPress is not a very resource-intensive application to begin with.

      1) I’d recommend you scale to a bigger VM if your %CPU is consistently above 30% – but this is just a recommendation. It is true that lower is generally better.

      2) To scale down your VM, follow this guide from Google Cloud. Make sure to start your instance again after you’ve made the changes, and run the following command to restart services on the VM once it’s started:

      sudo /opt/bitnami/ctlscript.sh start

      Let me know if you have any questions,
      Joe

    • louisa says

      January 19, 2019 at 10:36 am

      I used the df command, but the result is confusin. I will summarize what I assume is the important info.

      File system Use%
      udev 0%
      tmpfs 11%
      /dev/sda1 31%
      tmpfs 0%
      tmpfs 0%
      tmpfs 0%

      I don’t know what “udev” “tmpfs” “/dev/sda1” mean. Which row should I look at to determine the size of my site? And if the size gets to a certain %, should I upgrade to a larger VM? Thank you for your help!!!

    • Leron Amin says

      January 19, 2019 at 1:18 pm

      Hi Louisa,

      The only disk partition you should be concerned with is /dev/sda1 – which is currently at 31%. I’d recommend resizing when the /dev/sda1 partition starts to approach 70-80% capacity.

      To upgrade, you would not upgrade your machine type – you would simply resize the persistent disk attached to your VM.

      Let me know if you have questions,
      Joe

    • louisa says

      January 21, 2019 at 1:57 pm

      I am afraid my knowledge of Google Cloud is really lacking. Do you know any books or tutorials online you can recommend that can teach me about Google Cloud. Since I don’t know anything, I think the simpler the info, the better, maybe beginner’s stuff first. I researched online, but I am overwhelmed by the options I don’t know what to choose. Thank you.

    • Leron Amin says

      January 24, 2019 at 9:50 pm

      Hi Louisa,

      Unfortunately there aren’t many beginner tutorials available on the subject. I’d recommend getting familiar with installing applications on Google Cloud using a variety of Google Cloud services – this will give you good exposure to everything GCP offers and will give you a better understanding of the platform. Also – check out Google’s Codelab tutorials!

      Good luck!
      Joe

  23. Benoy says

    December 12, 2018 at 9:52 am

    Hello Leron,
    This is Benoy again. I did the activation of the expires headers module and started the server. I am getting the following notice as I restart it. Is this normal? You know I am not a techie

    Syntax OK
    /opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
    /opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
    /opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
    /opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
    /opt/bitnami/php/scripts/ctl.sh : php-fpm started
    Syntax OK
    /opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80

    Reply
    • Leron Amin says

      December 12, 2018 at 10:15 am

      Hi Benoy – that looks correct!

    • Benoy says

      December 14, 2018 at 11:06 am

      Thanks a ton!

    • Leron Amin says

      December 14, 2018 at 5:14 pm

      No problem! 🙂

    • Benoy says

      December 14, 2018 at 11:15 am

      Thanks a ton. Just a suggestion if you have time:

      updating php version from 7.0.31 to 7.2+

      would be great help. And there was an email from gcp regarding updating to new regional cpu – I was successful in editing the same. Thanks for all the tutorials which gave me an idea. Can I also opt for a larger disk size by editing the same? Just wanted to query the expert before plunging in. Thanks!

    • Leron Amin says

      December 14, 2018 at 6:39 pm

      Hi Benoy,

      I will do a tutorial at some point for upgrading PHP versions on Click-to-deploy. Unfortunately, there’s no easy way to upgrade with Bitnami (that I know of) – you’d have to migrate the application to a new stack with all updated components.

      And yes – you can increase your disk size at any time by going to Compute Engine > Disks, then clicking the “Edit” button at the top of the page. The only downside to this is that you can’t scale the disk size down – so make sure to increase your disk size only by the necessary amount, especially if you’re using SSD (they’re expensive compared to HDDs).

      Hope this helps and let me know if you have questions,
      Joe

    • Benoy says

      December 14, 2018 at 11:18 pm

      Thanks for your help. Disk query is solved 🙂 Yes, I was trying to increase it as the snapshots took some space.

      Regarding the bitnami php updates, a video on the migration stuff you mentioned would be a great help not only to me but to a lot of people trying to do it. Of course your time is precious and I guess there are a lot of requests apart from mine. No hurry, do update it only if you have some free time to spare. At the moment 7 version is doing just fine.

      So long, do keep up the good work.

    • Antony Warmbold says

      July 30, 2020 at 2:27 am

      Hi Joe,

      Your tutorials are amazing, thank you so very much for all this work, it’s amazing.
      Did you have any time to look into showing us how to upgrade PHP on a Click-to-deploy instance?
      I am starting to panic as I am seeing that WooCommerce will soon require PHP version 7.2 or newer..

    • Leron Amin says

      September 28, 2020 at 10:41 am

      Hi Antony,

      Thanks for the feedback.

      I would recommend migrating your WordPress install to a later stack with all updated components.

      Let me know if you have other questions,
      Joe

  24. Faheem says

    November 29, 2018 at 1:31 am

    Hi Leron,

    I’m still waiting for Non-batnami version.

    Reply
  25. Johnson says

    November 29, 2018 at 12:19 am

    Sir, My Name is Johnson From Tamil Nadu, India… Your Service is Very Good… First Thank You….

    I Want Add Expires Headers for WordPress on Google Cloud. Please Upload This Video…

    Reply
    • Leron Amin says

      December 3, 2018 at 12:30 am

      Hi Johnson – were you looking for a version of this tutorial for WordPress Click-to-deploy?

  26. Benjamin Waller says

    November 10, 2018 at 3:57 am

    Hey Joe,
    Hope your well.

    I was wondering whether it is worth doing this to my Moodle LMS https://www.hocvietngu.com/ since when checking the GTmetrix report I get a score of B (89) without doing anything! And for the Waterfall, the following:
    Expires:Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control : no-store, no-cache, must-revalidate

    My other question, not specifically related to this article but an Apache question. I have an issue with my Moodle is not receiving the Authentication header it requires from your Apache/PHP setup. To fix the issue I have been instructed to set the ‘CGIPassAuth on’ in your Apache config or .htaccess file. What I don’t know is where I can find that file to turn it on?
    Would it be in this file?“`/opt/bitnami/apps/wordpress/conf/httpd-app.conf“`
    You can refer to the Apache page reference on this. https://httpd.apache.org/docs/2.4/en/mod/core.html#cgipassauth

    Best regards,
    Ben

    Reply
    • Leron Amin says

      November 14, 2018 at 12:29 pm

      Hey Ben,

      I was researching your question but it appears you were able to get an answer here. Did that end up working correctly? If not, let me know and I will look into it.

      Also, I wouldn’t use this tutorial with Moodle, as it has only been tested with WordPress. Also, it appears Moodle has their own system/instructions for caching which can be viewed here.

      Let me know if you have any questions,
      Joe

    • Benjamin Waller says

      November 14, 2018 at 7:42 pm

      Thanks Joe,
      Yes, I had posted on Bitnami’s forums but unfortunately adding that change to the config file hasn’t worked yet. But I will try turning on a couple of the modules that are used by the CGIPassAuth such as (mod_cgi, mod_cgid, mod_proxy_fcgi, mod_proxy_scgi,) to see if it can pass the quiz results from this function : get_headers see Moodle docs https://github.com/moodle/moodle/blob/v3.5.2/mod/lti/OAuth.php#L744

      And thanks for that link, I will read up on how Moodle handles caching.

  27. Faheem says

    November 7, 2018 at 6:26 am

    Hi Leron,

    Dear, I want to know how to fix the header on the Non-Bitnami version of WordPress on google cloud.

    Thanks in advance

    Faheem

    Reply
    • Leron Amin says

      November 9, 2018 at 10:32 pm

      Hi Faheem – I will try to make a tutorial on the subject soon, hopefully next week.

    • Faheem says

      November 10, 2018 at 12:12 am

      Thanks a lot, Leron,

      I’m waiting I m a regular reader of your blog.

      try to make earlier.

      Thanks Faheem

    • Leron Amin says

      November 14, 2018 at 11:50 am

      Thanks Faheem – I will try!

  28. Ale Duran says

    November 2, 2018 at 8:39 am

    Hi Lero,

    Thank you for amazing tutorial, i have a quick question I would like to apply this in a normal installation of wordpress not using click-to-deploy version. Can be this one safe for that ?

    Thank you.

    Reply
    • Leron Amin says

      November 3, 2018 at 7:59 pm

      Hi Ale,

      So are you just using your own LAMP stack? I’m not 100% sure what you mean by a ‘normal installation of WordPress’.

      Let me know and I will see how I cant help!

    • Ale Duran says

      November 12, 2018 at 4:20 am

      I was meaning Non-Bitnami version of WordPress on google cloud. But i saw that you are working on that tutorial…. Just another quick question. Could you please explain what is the different between Non-Bitnami and with Bitnami. On your experience which one is better.

    • Leron Amin says

      November 14, 2018 at 1:19 pm

      Hi Ale,

      I’ve had a lot of requests for this tutorial, so yes, I am working on it right now.

      Regarding Bitnami v. Click-to-deploy: The Bitnami stack come with a few more components than Click-to-deploy, and it’s a bit more complicated to setup. For instance, with Bitnami, PhpMyAdmin is accessibly only via SSH tunnel. Additionally, changing the WordPress site URL’s via the WordPress settings dashboard is disabled – this must be done from the backend in your wp-config.php file. Although these seem like minor inconveniences, they can make the setup process profoundly more difficult for developers who are new to Google Cloud/linux administration.

      In conclusion, if you need a more feature-rich stack with greater security and pre-configured performance upgrades (e.g. mod_pagespeed), then go with Bitnami. If you need to get up-and-running quickly, and prefer a more bare bones stack, go with Click-to-deploy.

      Talk to you soon,
      Joe

  29. Rudhra says

    October 29, 2018 at 3:47 am

    Followed the instructions but no change in the Gt metrix report. I am using Cloudflare. Is there anything else I must do and also I don’t see Get header.jpg in my waterfall chart

    Reply
    • Leron Amin says

      October 29, 2018 at 11:27 am

      Hi Rudhra,

      If you’re using Cloudflare, you will need to follow these steps to fix the problem:

      From your Cloudflare dashboard, click on the Caching icon at the top of the page – this will take you to your Cloudflare caching settings.

      From the Cloudflare caching settings page, scroll down to the Browser Cache Expiration section, and change the setting to Respect Existing Headers. See step 4 of the Cloudflare tutorial for images of the process.

      Let me know if you have any questions,
      Joe

  30. Pranav says

    October 16, 2018 at 3:13 am

    Visual editor is not working in bitnami certified wordpress installation on google cloud platform. How to enable it?

    Reply
    • Leron Amin says

      October 16, 2018 at 12:02 pm

      Go to Users > Click on your user > then uncheck the “Disable the visual editor when writing” box.

    • Pranav says

      October 16, 2018 at 12:07 pm

      It is already unchecked but still visual editor is not showing.

    • Leron Amin says

      October 16, 2018 at 12:12 pm

      I’m not sure then – this is the first I’ve heard of this issue. Try researching StackOverflow and Google to see if any other individuals have experienced a similar issue. Please update me if you’re able to find the solution.

    • Pranav says

      October 16, 2018 at 12:23 pm

      I searched but couldn’t found any solution. Even I reinstall the WordPress by going to updates but still facing the same issue. Can you tell me what is the best other WordPress installation option available other than bitnami in Google cloud?

    • Leron Amin says

      October 16, 2018 at 12:41 pm

      There is a full series of tutorials on the WordPress Click-to-deploy stack – that’s the best alternative to using Bitnami.

  31. Arman Ali says

    October 8, 2018 at 3:26 pm

    Hey leron,
    How to make sub domain in google cloud also install ssll in sub domain also?
    Please make a video on this topic please make fast.
    Thanks

    Reply
    • Leron Amin says

      October 8, 2018 at 3:44 pm

      Thanks for the suggestion Arman – I will look into creating this tutorial!

  32. Lee says

    October 5, 2018 at 2:32 pm

    Hey Leron, Can you guide me on resetting my wordpress user password. I tried to follow the bitnami wordpress stack and I can’t seem to change my password. I’m using the temporary password.

    Reply
    • Leron Amin says

      October 5, 2018 at 2:41 pm

      Hey Lee – what issue are you having with the reset process?

    • Lee says

      October 13, 2018 at 5:02 pm

      How do you change the temporary admin password?

      For example. http://www.example.com/admin

      How do I change this password to login to wordpress from any computer? Do I access myadminphp?

      Can’t get this to work for some reason.

      thanks!

    • Leron Amin says

      October 15, 2018 at 1:30 am

      Hi Lee,

      From your Google Cloud dashboard navigate to Marketplace > My Solutions. There you will find your WordPress credentials.

      If you’re using Click-to-deploy, you can access phpmyadmin via http://www.example.com/phpmyadmin. With Bitnami, phpmyadmin is only accessible via SSH tunnel.

      Let me know if you have any questions,
      Joe

  33. Karun Manohar says

    September 24, 2018 at 5:22 am

    Hi, I tried editing the .htaccess for my WordPress to improve speed by leveraging browser caching.
    it is hosted on google cloud (Click to deploy) but Gtmetrix still reports the error to leverage browser caching and add expires header.

    Could you help me, Thanks in advance.

    Reply
  34. Ay says

    September 19, 2018 at 12:12 pm

    Hello Leron
    there is a question not related to the post
    when migrate my site from old host to google cloud host
    found that the pagespeed module change the image URL to another type of image
    I want to disable this type of filters in page speed
    the new url of the image found like that
    https://www.nnnn.com/wp-content/uploads/2018/09/xabdomen-belly-exercise-220×150.png.pagespeed.ic.wm-d4uDlqM.webp

    Reply
    • Leron Amin says

      September 19, 2018 at 8:26 pm

      Hi Ay,

      You can disable mod_pagespeed by following the instructions here. Also, here is more information about the image filters. Lastly, your mod_pagespeed configuration can be accessed by running the following command:

      sudo nano /opt/bitnami/apache2/conf/pagespeed.conf

      Remember, the rewrite is not permanent, and serves to optimize your image for better performance – see here.

      Let me know if you have any questions,
      Joe

  35. Sean says

    August 24, 2018 at 9:31 pm

    Hi Leon,

    How would we adapt your walk thru above for an nginx version?

    I am on Bitnami WordPress With NGINX And SSL For Google Cloud Platform

    Thanks

    Reply
    • Leron Amin says

      August 25, 2018 at 11:58 am

      Hi Sean,

      The process is similar. Check out this section of the Bitnami documentation for instructions on how to configure mod_rewrite caching.

      Hope this helps,
      Joe

    • Sean says

      August 25, 2018 at 10:45 pm

      Thanks Joe, however, the file /opt/bitnami/apps/wordpress/conf/htaccess.conf does not exist on the nginx version at that location so while the instructions are on the correct page for bitnami, the instructions are incorrect. I have notified bitnami but not sure what to do from here.

    • Leron Amin says

      August 28, 2018 at 9:35 am

      Hey Sean,

      Sounds good – let me know what you find out.

      Joe

  36. Subhojit Mazumder says

    August 21, 2018 at 8:13 am

    sir “onepagezen.com” this website is configuration The 0.6GB shared 1vCPU machine is a great value for small WordPress sites

    Reply
  37. Mohd Syahrizan Senan says

    August 13, 2018 at 7:31 pm

    Hi Leron, your website very valuable for me. After I’m finish my installation WordPress Bitnami, I can’t find Htaccess file as usual like sharedhosting. When I try install certain plugin that have to use httacess, it’s will create new htaccess file but nothing happen to my website.

    Is WordPress Bitnami hide htaccess file?

    Reply
    • Leron Amin says

      August 14, 2018 at 12:28 pm

      Hi Mohd,

      There is an htaccess file which exists at the following location:

      /opt/bitnami/apps/wordpress/conf/htaccess.conf

      Hope this helps,
      Joe

    • Mohd Syahrizan Senan says

      August 14, 2018 at 4:58 pm

      Thank you Leron!

  38. Akash says

    August 11, 2018 at 6:30 am

    Please tell me how to do this for the Click to deploy wp Version

    Reply
    • Leron Amin says

      August 13, 2018 at 2:50 pm

      Hi Akash,

      I will be publishing a tutorial for Click-to-deploy soon!

      Talk to you soon,
      Joe

    • Bruno A. Jimenez Reyes says

      October 2, 2018 at 3:55 am

      Hi, any news about the click-to-deploy version?

    • Leron Amin says

      October 8, 2018 at 3:16 pm

      Hi Bruno – not yet – but thanks for the reminder! Hopefully soon!

  39. Anurag Tripathi says

    August 11, 2018 at 5:56 am

    Great i am about to ask for it .
    how about click to deploy version ?

    Reply
    • Leron Amin says

      August 13, 2018 at 2:51 pm

      Hi Anurag,

      I will be publishing the Click-to-deploy version soon!

      Talk to you soon,
      Joe

  40. Leron Amin says

    July 22, 2018 at 4:41 pm

    What did you think of this tutorial?
    Please share your questions and comments below!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Want Exclusive Tutorials?

Welcome to One Page Zen!

Through this blog I hope to introduce web developers to cloud computing!

author-bio

facebook-support-group kinsta-cloud-hosting

Want Exclusive Tutorials?


Contact | Sitemap | Legal | Privacy Policy | Affiliate Disclosure
      Copyright © 2017 - 2019 One Page Zen
Share this Article

Email sent!