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

Posted August 21, 2017 1.2k views
NginxUbuntu 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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

What is the domain?