Search code examples
google-app-enginesslhttpscloud

How to Add SSL to Google Cloud Wordpress Launcher Site


Google provide Wordpress Launcher although in beta. I have try them by adding custom domain via Google Cloud DNS, but i still not success in adding custom domain with SSL (https).

Any Idea ?


Solution

  • Wordpress from Google Click to Deploy launches on Google Compute Engine, not Google App Engine, meaning you are getting an entire Debian virtual machine, not just an App Engine instance. The App Engine instructions are not applicable.

    Here's the process I used (replace "www.veggie.com" with your domain):

    1. Go to Deployment Manager and select your Wordpress deployment.
    2. Under "Get Started with WordPress", click "SSH" to open a Google Cloud Shell console on the Debian virtual machine hosting your site.
    3. If you haven't already, generate a CSR using openssl req -new -newkey rsa:2048 -nodes -keyout www_veggie_com.key -out www_veggie_com.csr. More info
    4. You will be prompted with some questions. Answer them using letters and numbers only. For example:

      Country Name (2 letter code) [AU]:US
      State or Province Name (full name) [Some-State]:New Mexico
      Locality Name (eg, city) []:Albuquerque
      Organization Name (eg, company) [Internet Widgits Pty Ltd]:Veggie Inc   # put "NA" if not applicable
      Organizational Unit Name (eg, section) []:NA                            # put "NA" if not applicable
      Common Name (e.g. server FQDN or YOUR name) []:www.veggie.com           # MUST BE the website you are securing. Use *.veggie.com if you purchased a wildcard certificate
      Email Address []:[email protected]
      A challenge password []:                # just leave this blank
      An optional company name []:            # leave this blank too
      
    5. Move the private key to a safe place, e.g. sudo mv www_veggie_com.key /etc/ssl/ssl.key/
    6. View the CSR (Certificate Signing Request) file using cat www_veggie_com.csr. It should look something like this:

      -----BEGIN CERTIFICATE REQUEST-----
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      sdkfjhksdjfhkjsdvbksdjfkhsdkfhskdjfhskjdfhksdjfhkdsjvbnksjksjkjh
      2398dfjk3290fdsjk3290slk093koldfj3j0igr0/4387yvdjkn4398fdh92439h
      3fjkbdjgkedkj4vie929ckw0gfjdfgjs90q=
      -----END CERTIFICATE REQUEST-----
      
    7. Copy the contents of the CSR file to your clipboard (in Google Cloud Shell, just highlight the text with your mouse and hit Ctrl+C).

    8. Go to the site where you purchased the certificate and find the option to Activate the certificate. You should be prompted to upload or copy and paste the CSR. If you are prompted to confirm the server type, it is an Apache server. After I did that, my certificate issuer sent me the certificates via email.
    9. Once you have your certificates, return to the Google Cloud Shell.
    10. Use the gear menu > Upload File to upload your SSL certificates to your server. I put the certificates in /etc/ssl/ssl.crt/.
    11. Enter sudo nano /etc/apache2/sites-available/wordpress.conf to use Nano to edit your server's configuration file to point to your certificate(s) and your key file. My wordpress.conf only had a <VirtualHost *:80> section, so I added a <VirtualHost *:443> section at the bottom:

      <VirtualHost *:443>
        ServerAdmin [email protected]
        ServerName www.veggie.com:443
        DocumentRoot /var/www/html
      
        # Copy <Directory /> and other settings from <VirtualHost *:80> here as well
      
        SSLEngine on
        SSLCertificateFile /etc/ssl/ssl.crt/www_veggie_com.crt
        SSLCertificateKeyFile /etc/ssl/ssl.key/www_veggie_com.key
        SSLCertificateChainFile /etc/ssl/ssl.crt/www_veggie_com.ca-bundle
      </VirtualHost>
      

      Copy the stuff already in <VirtualHost *:80> and add the SSL lines

    12. Restart the Apache server using sudo service apache2 restart
    13. Try visiting your homepage via https (e.g. https://www.veggie.com) and see if it worked.