Welcome! Log In Create A New Profile


Basic Question: Unable to access https:// with www prefix

August 04, 2016 11:03AM

I followed the instructions at Digital Ocean for setting up a WordPress installation, including enabling HTTPS on the nginx server.

(The instructions are here: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04)

When accessing https://www.comfortglobalhealth.com, I am always redirected to https://comfortglobalhealth.com. Can someone suggest what change I need to make to my nginx configuration file so that this redirect doesn't happen?


Here is my config:

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name comfortglobalhealth.com www.comfortglobalhealth.com;
return 301 https://$server_name$request_uri;

server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/ssl-comfortglobalhealth.com.conf;
include snippets/ssl-params.conf;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name comfortglobalhealth.com www.comfortglobalhealth.com;
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;

location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;

location ~ /\.ht {
deny all;
location ~ /.well-known {
allow all;

Here are my snippets:

ssl_certificate /etc/letsencrypt/live/www.comfortglobalhealth.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.comfortglobalhealth.com/privkey.pem;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
resolver valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
Subject Author Posted

Basic Question: Unable to access https:// with www prefix

lukemroz August 04, 2016 11:03AM

Re: Basic Question: Unable to access https:// with www prefix

Francis Daly August 04, 2016 12:48PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready