How do I point my "mail" hostname to Google Apps while having SSL enabled in Nginx

August 21, 2017 350 views
Nginx Ubuntu 16.04

Actual web URLs redacted

My issue is that I am trying to point my site with host mail ( to Google Apps.

I have a CNAME record for pointing to and the Google Apps admin panel shows the website is properly connected. It used to all work before I configured SSL with certbot.

This is my nginx config:

server {
    listen 80;
    listen [::]:80;

    server_name; # actual URL names redacted
    root /var/www/ghost/system/nginx-root;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;


    location ~ /.well-known {
        allow all;

    client_max_body_size 50m;

    # Redirect non-https traffic to https
    # if ($scheme != "https") {
    #     return 301 https://$host$request_uri;
    # } # managed by Certbot

    listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
1 Answer
Have another answer? Share your knowledge.