"rewrite" structure for subdomain

Discussion in 'Installation/Configuration' started by Emsanator, Dec 25, 2021.

  1. Emsanator

    Emsanator Member

    You're right.

    What exactly do you understand from this text? Am I saying that the ISPconfig project is a problematic project or is missing, unable to do its job? Dear Till, I would like to thank you for your efforts for ISPconfig, but if you care about criticism or other people's opinions, I recommend that you evaluate it from a general point of view, not your own truth.

    I didn't say anything bad about the project. Don't be fragile here. If I had bad intentions, I would have used other words. It is not my intention to humiliate you or the project. It's my own fault of course because of the new year there may be very few online users and that's why I may have thought about it.

    In short, I respect every open source project and everyone who supports its users, it is not my intention to offend anyone or disparage the project. Do not try to manipulate or misunderstand my message.

    Btw, It goes without saying that it is installed on an average of 1000 servers per day. The important thing is whether an average of 1000 servers continue with the installed software.

    If you agree, let's close this issue now.
     
    till likes this.
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I don't see how your issue is solved so I don't agree when you claimed it as such but of course you can withdraw at any time as it is your choice except ISPConfig is never a problem there but you in doing thing(s) your way(s).

    I already advised on the easier way to resolve your problem which is by using ISPConfig with apache2 webserver and slowly learn nginx with ISPConfig as I know nginx can be frustating to many depending on how one wants it to work with one's server(s).

    There are basically in my view two main type of nginx users one who wants to use it as a standalone webserver and one who wants to use it as proxy for apache2 webserver but the main reason for both is mainly in handling of many concurrent users.

    I guess the last part may include you i.e. in handling of many concurrent users though you may not realized it can be achieved in both ways but I think 'with nginx as proxy to apache2 webserver' may be a better option for you for now but of course you'll need to know how that works correctly too.

    I'd say feel free to open new threads and ask questions until you understand and comprehend more but leave the blaming ISPConfig attitude or other people if you truly respect it and contributing peoples behind it.
     
    Emsanator likes this.
  3. slagroom

    slagroom Member

    As I wrote earlier, I've done my share of extremely busy heavy loaded website hosting, and if you want to use NGINX for its performance benefits over apache, it has some details you need to know about when rewriting/redirecting:

    For your vhost redirects/rewrites, nginx' return handling is way faster than rewrites, so in order to rewrite to subdomain xyz from subdomain abc or no subdomain at all, do this (note there's an extra server block with the correct end-result server_name):
    Code:
    server {
        listen  443 ssl;
        listen  [::]:443 ssl;
        server_name domain.tld abc.domain.tld www.domain.tld;
        include /etc/nginx/yourTLSconfig;
        return 307 https://xyz.domain.tld$request_uri;
    }
    server {
        listen  443 ssl;
        listen  [::]:443 ssl;
        server_name xyz.domain.tld;
        include /etc/nginx/yourTLSconfig;
    
        root /srv/domain.tld;
        index index.php index.html index.htm;
    
    # if you need good old redirects, for example
    # from https://xyz.domain.tld/mail to https://mail.domain.tld
    # this is the best way to do it:
    
    location /mail { rewrite ^(.*)$ https://mail.domain.tld/ redirect; }
    
        [..your server stuff..]
    }
    
    To have port 80 requests go to their 443 equivalents for an entire webserver, put the following in a file under /etc/nginx/conf.d/
    To specify the catch-all name or default server you need to use the *listen* directive, not the server_name directive! See also https://nginx.org/en/docs/http/request_processing.html
    - $host catches subdomain names.
    - 307 and 308 include both POST and GET request URIs.
    - 307 is Temporary, change to the Permanent 308 after thorough testing ( i.e.: # return 308 https://$host$request_uri ):
    Code:
    server {
      listen 80 default;
      listen [::]:80 default;
      return 307 https://$host$request_uri;
    }
    
     
    Last edited: Sep 15, 2023

Share This Page