1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to allow one domain SSLDomain1\.info to use SSL whilst rest of the domains (hundreds of them

Discussion in 'Nginx' started by eurusd, May 18, 2017.

  1. #1
    How to allow one domain SSLDomain1\.info to use SSL whilst rest of the domains (hundreds of them and dynamically added, need wildcard _) are simple HTTP 80 ?

    If I use
    Server{ FOR SSLDOMAIN.info }
    Server{ FOR REST}

    Then
    I can’t have both ssl and http ☹
    It is one way or another, very annoying nginx, not flexible

    Nginx gives error no matter how I try

    Why can’t I use simple condition?

    If ($host=”SSLDOMAIN1.info”){
    ssl on;
    ssl_certificate /var/www/SSLDomain1.info/ssl/SSLDomain1_info.bundle.crt;
    ssl_certificate_key /var/www/SSLDomain1.info/ssl/SSLDomain1_info.key;
    }



    example of conf


    server {
    listen 80;
    listen 443 ssl;



    if ($host ~* (SSLDomain1\.info)){
    #ssl on;
    #ssl_certificate /var/www/SSLDomain1.info/ssl/SSLDomain1_info.bundle.crt;
    #ssl_certificate_key /var/www/SSLDomain1.info/ssl/SSLDomain1_info.key;
    }
    server_name _;
    server_name_in_redirect off;

    if ($host ~* ^(.*\..*)$) {
    set $domain $host;
    }

    if ($host ~* ^(.*)\.(.*\..*)$) {
    set $domain $2;
    }



    root /var/www/$domain;

    location / {
    index index.php;
    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?$1 last;
    break;
    }

    location ~ \.php$ {
    fastcgi_pass php;
    fastcgi_index index.php;
    include fastcgi.conf;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    }
    }
    }
     
    Last edited: May 18, 2017
    eurusd, May 18, 2017 IP