Www and non-wwww not setup by default


#1

Is anyone else having trouble with both www and non-www sites? I had to manually edit /opt/easyengine/sites/example.com/config/nginx/conf.d/main.conf to add www.example.com
server_name example.com www.example.com;


#3

www to non-www and vic-versa redirection files are setup in the following directory:
/opt/easyengine/services/nginx-proxy/conf.d/

There is no need to manually make edits. Please send the output of:

ls -al /opt/easyengine/services/nginx-proxy/conf.d/

Also, send the output of ee cli info.

If the files are not setup here then this issue might need debugging.


#4

Thanks for the hint. I see the redirects in there. This might help with cleaning up Cloudflare redirect loops.


#5

@mrrobot47

ls -al /opt/easyengine/services/nginx-proxy/conf.d/

it returns for me:

-rw-r--r-- 1 root root 2.9K Dec  9 08:48 default.conf

…and this is my ee cli info output:

+-------------------+----------------------------------------------------------------------------+
| OS                | Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 |
| Shell             | /usr/bin/zsh                                                               |
| PHP binary        | /usr/bin/php7.2                                                            |
| PHP version       | 7.2.13-1+ubuntu18.04.1+deb.sury.org+1                                      |
| php.ini used      | /etc/php/7.2/cli/php.ini                                                   |
| EE root dir       | phar://ee.phar                                                             |
| EE vendor dir     | phar://ee.phar/vendor                                                      |
| EE phar path      | /var/lib/docker/volumes/global-nginx-proxy_confd/_data                     |
| EE packages dir   |                                                                            |
| EE global config  | /opt/easyengine/config/config.yml                                          |
| EE project config |                                                                            |
| EE version        | 4.0.4                                                                      |
+-------------------+----------------------------------------------------------------------------+

I did setup a new web site (eg: ee site create davide.net --type=wp), and trying to reach www.davide.net I am getting:

# 503 Service Temporarily Unavailable

Thanks for any help.


#6

I had a site that was www.example.com and I had to create it with ee site create www.example.com otherwise it would just redirect loop. example.com would properly get redirected to www.example.com. There were too many links to www.example.com buried in the site to try to change it to non-www.


#7

Hello,

I need non-www (naked domain) to forward to www. So domain.com to www.domain.com. I ran the below command using a sudo user:

sudo ee site create www.domain.com --type=wp --ssl=le --wildcard

I added the txt records and ran sudo ee site ssl www.domain.com once the records propagated. The SSL successfully installed. When I visit domain.com I get an SSL error but when I visit www.domain.com everything works great.

I have tried multiple times and when creating the site using www, the non-www doesn’t forward.

When I run:

I get:

-rw-r–r-- 1 root root 3665 Mar 5 16:43 default.conf
-rw-r–r-- 1 root root 780 Mar 5 16:42 www.domain.com-redirect.conf

When I run:

ee cli info

±------------------±---------------------------------------------------------------------------+
| OS | Linux 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 |
| Shell | /bin/bash |
| PHP binary | /usr/bin/php7.2 |
| PHP version | 7.2.15-1+ubuntu18.04.1+deb.sury.org+1 |
| php.ini used | /etc/php/7.2/cli/php.ini |
| EE root dir | phar://ee.phar |
| EE vendor dir | phar://ee.phar/vendor |
| EE phar path | /root |
| EE packages dir | |
| EE global config | /opt/easyengine/config/config.yml |
| EE project config | |
| EE version | 4.0.10 |
±------------------±---------------------------------------------------------------------------+

Any suggestions?

Thank you


#8

I put all my sites behind the free tier of Cloudflare. You can create a Rule on Cloudflare to bounce the site to www before it even hits EE.


#11

How?Plz give me a hint


#12

Just add a new CNAME record with www in it.


#13

I get that there are workarounds to solve this issue (Cloudflare and different DNS settings). I think all of us just want a solution that works for EE.


#14

Have you tried creating the site with a regular LE cert instead of the wildcard? It is my understanding that the wildcard still needs the naked domain listed as a SAN (Subject Alternative Name).

You might also be able to adjust the LE settings by shelling into the proxy container (docker exec -it services_global-nginx-proxy_1 bash) and looking at LE settings in the /etc/nginx/conf.d/ folder.


#15

You are correct. A regular LE does create the redirects without issues. Thank you for the insight.