Join the community today
Become a Member

SSL Issues with Force www

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by denellum, May 11, 2016.

  1. denellum

    denellum Member Premium Member

    79
    19
    8
    May 11, 2016
    Dallas
    Ratings:
    +24
    Local Time:
    9:56 PM
    1.11.10
    10.1.21
    Having issues with forcing https://www to a domain. Been beating my head against the desk for the past couple of days to no avail. Do you guys see anything wrong? At this point i feel it's simple and just need a fresh set of eyes. (staring at the same code all day)

    The domain is Anomaly - The Front Page

    Here is the anomaly.ws.conf:


    Here is the anomaly.ws.ssl.conf :

     
  2. eva2000

    eva2000 Administrator Staff Member

    29,051
    6,593
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,789
    Local Time:
    12:56 PM
    Nginx 1.13.x
    MariaDB 5.5
    Posted at centminmod.com/nginx_domain_dns_setup.html#httpsredirect

    key to testing is using 302 temp redirect first in a private incognito browser session otherwise the problems you can experience may end up being due to browser caching or 301 permanent redirects unless you clear browser cache and reboot local computer(s) and even then some web browsers don't let go of 301 permanent redirect browser cache that willingly :)

    You have it wrong way round those configs are telling to redirect non-www to www
    just change in http port 80 non-ssl vhost conf file

    from
    Code (Text):
    server_name anomaly.ws;
    return 302 $scheme://www.anomaly.ws$request_uri;

    to
    Code (Text):
    server_name anomaly.ws www.anomaly.ws;
    return 302 https://anomaly.ws$request_uri;

    and in https port 443 ssl vhost conf change to
    Code (Text):
    server {
    listen 443 ssl http2;
    server_name anomaly.ws;
     
    • Like Like x 1
  3. denellum

    denellum Member Premium Member

    79
    19
    8
    May 11, 2016
    Dallas
    Ratings:
    +24
    Local Time:
    9:56 PM
    1.11.10
    10.1.21
    First off thank you for the reply!

    But i feel i worded my issue wrong... i want it to force https and www. So i want the following :
    Code:
    http://Anomaly.ws
    www.anomaly.ws
    
    All to redirect to :
    Code:
    Https://www.anomaly.ws
    
     
    Last edited: May 11, 2016
  4. denellum

    denellum Member Premium Member

    79
    19
    8
    May 11, 2016
    Dallas
    Ratings:
    +24
    Local Time:
    9:56 PM
    1.11.10
    10.1.21
    All resolved, read through that documentation! Solved my issue completely when i disabled the non ssl.conf.

    Thank you for the help eva!!!!
     
    • Like Like x 1
  5. eva2000

    eva2000 Administrator Staff Member

    29,051
    6,593
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,789
    Local Time:
    12:56 PM
    Nginx 1.13.x
    MariaDB 5.5