askar-website/NOTES_ON_WORDPRESS.md
2024-07-20 00:23:59 +02:00

994 B

Notes on exporting/importing wordpress

Wordpress is an extremely tricky CMS to move. The local configuration assumes the root url being at http://localhost:8080, but we want to publish the site on a public, TLS protected address.

In order to do so, many steps have to be taken.

Export the db

The database has to be exported, and all occurrences of http://localhost:8080 have to be replaced with the public url, including the protocol.

Ensure that the wordpress installation knows its public url

Using wordpress provided by docker, we need to set in the production container environment the variable

WORDPRESS_CONFIG_EXTRA="define( 'WP_SITEURL', '<PUBLIC_URL>' );"

Configure the reverse proxy

The reverse proxy where the TLS termination happens must pass the following header to the wordpress container

X-Forwarded-Proto: https

otherwise all the assets are served through an unencrypted connection and the browser (rightly so), refuses to load them.