After adding SSL - site only reachable with www

Hi again support forum fans,

I have installed SSL on my site using ee site update warner.photo --letsencrypt. The update was successful, but now the site is only available if I add ‘www’.

So https://www.warner.photo is fine But http://www.warner.photo and www.warner.photo redirect to https://warner.photo And https://warner.photo is unreachable

  • I checked the /etc/nginx/conf.d/force-ssl-warner.photo.conf file and it seems fine. Changing the redirect there from “https://warner.photo” to “https://www.warner.photo” does not seem to have any effect though.

  • I would point the website to warner.photo (instead of www.warner.photo) in wp-config.php, but if I do that I get a redirect loop (see my earlier post)

How to proceed?

Thanks for any help! Warner

@warner

somewhere the configuration is having conflicts :slight_smile:
Since the help without accessing the server is limited, I could suggest you to try replacing your configurations with default configuration generated by EasyEngine.

Suggestion: 1 - backup your configurations (MUST incase we need to revert) cp /etc/nginx/sites-available/warner.photo /etc/nginx/sites-available/.warner.photo

2 - recommended install (php7) : ee stack install --php7

3 - replace /etc/nginx/sites-available/warner.photo with following

server {

server_name warner.photo   www.warner.photo;


access_log /var/log/nginx/warner.photo.access.log rt_cache;
error_log /var/log/nginx/warner.photo.error.log;


root /var/www/warner.photo/htdocs;



index index.php index.html index.htm;


include common/php7.conf;

include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/warner.photo/conf/nginx/*.conf;

}

4 - Check nginx configuration passes the test : nginx -t 5 - If above successfull, restart nginx & php7 :slight_smile:

@antopjoseph

ok, I tried your instructions and something is still wrong with php7:

ee stack install --php7 results in

  • “PHP 7.0 already installed”

and after updating and testing nginx -t I get

  • nginx: [emerg] no port in upstream “php7” in /etc/nginx/common/wpcommon-php7.conf:7

while netstat -ntualp |grep :9070 still gives

  • tcp 0 0 127.0.0.1:9070 0.0.0.0:* LISTEN 32226/php-fpm.conf)

and service php7.0-fpm status gives

  • ● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2017-06-13 15:15:34 CEST; 18h ago Docs: man:php-fpm7.0(8) Main PID: 32226 (php-fpm7.0) Status: “Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec” CGroup: /system.slice/php7.0-fpm.service ├─32226 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
    ├─32228 php-fpm: pool www
    └─32229 php-fpm: pool www

check following entries in /etc/nginx/conf.d/upstream.conf

upstream php7 { server 127.0.0.1:9070; }

and test nginx configuration using nginx -t

Ok, that worked. I successfully re-started nginx and php7.

So, now what to do? Currently I have set force-ssl-warner.photo.conf to https://www.warner.photo and wp_options siteurl and home values to http://www.warner.photo.

http://warner.photo, http://www.warner.photo and https://www.warner.photo all work now.

But https://warner.photo is still unreachable. Should I try to set them back to the original values now?

…changing the values back results in successful re-direction to https://warner.photo, but the site is unreachable.

@warner as I specified, stick to one of them only( warner.photo) . and redirect www.warner.photo to warner.photo in force-ssl-warner.photo.conf. and also change use https://warner.photos in wp-config.php.

Also once you confirm which domain is you are going to use (www or without www), you can use following wp-cli command to search & replace all unwanted occurances in DB.

As www-data user. wp search-replace www.warner.photo warner.photo --recurse-objects --verbose --dry-run (--dry-run to view what all change will be there, then remove --dry-run and run )