nginx configuration

Discussion in 'Installation/Configuration' started by durchd8.de, Jan 16, 2015.

  1. durchd8.de

    durchd8.de Member

    The nginx-configuration by ispconfig apparently lacks efficiency.

    My OS: CentOS7
    Version: latest + HHVM patch

    1. SEO-redirects are implemented by if-statements
    2. subdomain responses (eg. *) is done by wildcards and if statement
    3. ...

    Example:
    Code:
            if ($http_host ~* "^(.+)\.example\.com$") {
                rewrite ^ $scheme://example.com$request_uri? permanent;
            }
    
    The more efficient solution would be a seperate server statement:
    Code:
    server {
      server_name *.example.com;
      return 301 $scheme://example.com$request_uri;
    }
    
    Am aware there is an issue implementing it, since it is a new server statement.
    1. Am I mssing something?
    2. Any chance to change nginx implementation by adding a 2nd nginx options-window, which actually adds another server block?
     
  2. durchd8.de

    durchd8.de Member

    Alternatively: make rewrites a seperate vhost-file
     

Share This Page