AllowOverride All Cloud Engine template

2019-06-02 11:22发布

问题:

I am trying to run WordPress high availability on Google Cloud with the launcher and I get a problem with the AllowOverride All. I can set it manually on the content group instance but when another instance is created to handle the traffic, the new instance does not have the AllowOverride All on /etc/apache2/sites-enabled/wordpress.conf. I tried adding it in the .htaccess on the root WordPress folder that will sync to all the instances but it does not work.

Is there any other alternative to add it to WordPress to get permalink working ?

Thanks

回答1:

You can set a startup script in your instance template. Write a script that overrides the wordpress.con file with the content that you want and it will get executed on every instance's startup.

As you are running the WordPress High Availability solution from the GCP Marketplace, so the instance creation is managed by an instance group using a template. The whole update process would be something like the following:

  1. Go to the instance groups menu in your GCP Console, under Compute Engine.
  2. Identify the instance groups that belong to the WordPress high availability deployment and click in the template name
  3. Copy the template. Now you can edit the startup script under management. There might be a script already, just add yours. Give the template a name and save it.
  4. Now, to update the instance group to use the new template, edit the instance group and change the template it uses. After that you'll need to click the Rolling update button to actually update the instances.