Skip to main content

Setup wp-config.php for CloudFront.

 Set up the wp-config.php file to work with CloudFront.

CF distributions have HTTPS enabled by default for their default domain, something like yadayadayada.cloudfront.net. We will be configuring our WordPress instance to use HTTP as the origin of our distribution and configure our distribution to terminate SSL/TLS and forward all content requests to your instance using an HTTP connection.

The connection between the client and our CF distribution is encrypted using HTTPS. The connection between our distribution and EC2 instance is un-encrypted using HTTP only. This configuration is known as SSL/TLS termination.

We will configure your distribution’s origin protocol policy to use HTTP only, which is the default.

We will edit the WordPress configuration file on your instance to account for the TLS termination behavior from your distribution. If not, our site visitors will see a 502 error, or your website content might not be formatted correctly.

I always like to start by taking a snapshot of my WordPress instance before getting started. This snapshot will serve as a backup that we can restore to another instance if something goes sideways.

Next, we will need to ssh to our server; if you need the connection string, you can find it by selecting your EC2 instance and clicking on the connect button

> SSH client: under example, you will see a string that looks like this.

ssh -i "~\pathto\mykey.pem" ubuntu@ec2-1-1-1-1.compute-1.amazonaws.com

You can paste that into your terminal window or us with putty.

Now that we are connected to our instance, we need to do the following: enter the following command to create a backup of the wp-config.php file. This command assumes that path you will need to know your correct path.

sudo cp /var/www/mysite/wordpress/wp-config.php /var/www/mysite/wordpress/wp-config.php.backup

Now that we have a backup of the file let’s make some magic happen. Open wp-config.php with your favorite editor. I’ll be using vim.

sudo vi /var/www/mysite/wordpress/wp-config.php

Press “I” to enter insert mode and delete the following lines.

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

Add the following to the file where we just deleted the other two lines.

define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');
if (isset($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'])
&& $_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}

Press the ESC key to exit insert mode in Vim, then type :wq! and press Enter to save your changes and quit Vim.

Now we will restart apache2 with the following command.

sudo apache2ctl restart

If something went wrong, re-connect to your instance. Use the following command to restore the wp-config.php file with the backup you made when we first started.

sudo cp /var/www/mysite/wordpress/wp-config.php.backup /var/www/mysite/wordpress/wp-config.php

Popular posts from this blog

Interwoven Support Document Teamsite 7.1 ,6.7.2, Opendeploy, Data Deploy Mediabin, IDOl

Teamsite 7.1 ,6.7.2, Opendeploy, Data Deploy Mediabin, IDOl ts_71_admin_v01_en.pdf ts_71_CCstd_ug_v01_en.pdf od_71_dev_v01_en.pdf ts_72_spuser_en.pdf

do you know about CHAT GPT

ChatGPT is a pre-trained language model developed by OpenAI. It is based on the GPT (Generative Pre-trained Transformer) architecture, which is a type of neural network that is trained on a large dataset of text. The model is able to generate human-like text and can be fine-tuned for a variety of natural language processing tasks such as language translation, question answering, and text summarization. ChatGPT is designed to generate text in a conversational context, and it can be used to create chatbots, virtual assistants, and other conversational interfaces. It is also able to understand and respond to context, and can maintain a conversation flow. It is trained on a large dataset of conversational text, and it is able to understand and respond to context, and can maintain a conversation flow. ChatGPT is a conversational language model developed by OpenAI. It is based on the GPT (Generative Pre-training Transformer) architecture, which is a type of transformer neural network. ChatGP

ChatGPT In E-Commerce: 7 Ways Can Help Your E-Commerce Business Grow

E-Commerce businesses that want to survive and succeed in 2023 must embark on all the digital marketing trends and leverage all the year's technological advancements.  One of the technological advancements that are significantly expanding this year is chatbots. Chatbots have been helping eCommerce businesses for years. They are computer programs or software applications that are powered by artificial intelligence (AI), and that interact with customers and website visitors in real-time. They provide your customers with automated conversations about your products or services.  In November 2022, a new revolutionary AI technology got introduced to the world. This technology is called “Chat GPT”. It is an advanced form of chatbot developed by OpenAI, the American AI intelligence research laboratory. In this article, we are going to discuss what ChatGPT is and how it can benefit eCommerce businesses.  Table Of Content: What is Chat GPT? 7 ways to use Chat GPT in eCommerce: Generating Ide