Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx Getting confused about nginx config files

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Derek, May 6, 2018.

  1. Derek

    Derek Member

    47
    9
    8
    Aug 5, 2016
    Ratings:
    +22
    Local Time:
    11:34 AM
    So, I bought a new domain for a new forum, configured it, set up cloudflare, and everything works.

    The problem is that I bought the .net, .com, .org package, and I'm trying to have one virtual host respond requests and redirect appropriately from www.mydomain.net, mydomain.net, www.mydomain.org, mydomain,org, and so on.


    So I'm looking in the mydomain.tld.ssl.conf file thinking I can just list the alternate names in the server_name field, but it's listed twice and I can't figure out which is important, or if they both are, or...


    #x# HTTPS-DEFAULT
    server {

    server_name mydomain.tld www.mydomain.tld;
    return 302 https://mydomain.tld$request_uri;
    include /usr/local/nginx/conf/staticfiles.conf;
    }

    # listen 80;
    # server_name mydomain.tld www.mydomain.tld;
    # return 302 https://$server_name$request_uri;

    server {
    listen 443 ssl http2;
    server_name mydomain.tld www.mydomain.tld;

    include /usr/local/nginx/conf/ssl/mydomain.tld/mydomain.tld.crt.key.conf;
    include /usr/local/nginx/conf/ssl_include.conf;

    # cloudflare authenticated origin pull cert community.centminmod.com/threads/13847/
    #ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/mydomain.tld/origin.crt;
    #ssl_verify_client on;
    http2_max_field_size 16k;
    http2_max_header_size 32k;
    ...

    (I know, I should use code here but I wanted the boldface to work.)

    Where's the right place to list the domains I want to direct from?
     
  2. JJC84

    JJC84 Ad astra per aspera

    247
    109
    43
    Jan 31, 2018
    San Antonio, Texas
    Ratings:
    +169
    Local Time:
    10:34 AM
    1.15.x
    10.x.x
  3. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    6:34 PM
    Nginx 1.21.x
    MariaDB 10.3.x
  4. Derek

    Derek Member

    47
    9
    8
    Aug 5, 2016
    Ratings:
    +22
    Local Time:
    11:34 AM
    Thanks, folks.

    :)