.htaccess permissions & Apache restart | Bitnami Wordpress | Kubernetes

3/18/2019

I have seen alot of threads about this issue, but unfortunately, I cannot get my head around my issue. From all the threads I have been reading, it seems that directory structure has changed in the latest release of stable wordpress.

I am trying to achieve multiple things out of which:

  1. Allowing wordpress to generate the default config of htaccess. When I go to the permalinks settings, it asking me to add a piece of mod_rewrite code to htaccess as it has no write permission.

  2. I am trying to use certain plugins such as wp-rocket, all in wordpress security and firewall, but all these need to have access to htaccess to write certain rules.

  3. I am trying to also find the script to restarts, status of apache in this structure /opt/bitnami/ctlscript.sh restart but the sh script is no where to be found.

Can someone please guide me how to achieve the above please as I have been days researching and trying multiple things. I am using helm to install all this in a kubernetes environment on google cloud.

Much appreciated many thanks!

-- Jojo
.htaccess
bitnami
kubernetes
wordpress

1 Answer

3/19/2019

Note that Helm charts work in a different way than Bitnami stacks such as the Bitnami WordPress stack, so there are certain things such as restarting a service which are conceptually different if you are using Helm charts or stacks.

Keeping this in mind, I'm going to reply to your questions below:

  1. Allowing wordpress to generate the default config of htaccess. When I go to the permalinks settings, it asking me to add a piece of mod_rewrite code to htaccess as it has no write permission.
  2. I am trying to use certain plugins such as wp-rocket, all in wordpress security and firewall, but all these need to have access to htaccess to write certain rules.

Unfortunately the .htaccess file is not persisted between pods. However, you can workaround this by creating a .htaccess ConfigMap like described below:

https://github.com/helm/charts/tree/master/stable/wordpress#disabling-htaccess

Once done, you can customize the file /path/to/wordpress-htaccess.conf and add all necessary directives on your side.

But keep in mind this means WordPress won't be able to add them automatically on its side, you will need to add them on yours.

  1. I am trying to also find the script to restarts, status of apache in this structure /opt/bitnami/ctlscript.sh restart but the sh script is no where to be found.

Bitnami Helm installs do not use ctlscript.sh for managing services. Instead, the recommended way to restart WordPress in Kubernetes (or any Kubernetes service) is by deleting the pod.

Then, because it is launched inside a deployment, the pod will be recreated with the persisted configuration (same uploads, themes, database configuration, etc.).

-- marcosbc
Source: StackOverflow