DNS. Sub domain to Domain:port

Thread: DNS. Sub domain to Domain:port

  1. DejaVu's Avatar

    DejaVu said:

    Default DNS. Sub domain to Domain:port

    I've got a number of services running on my network and own my own domain name using DNSExit for Dynamic DNS.

    I can change or add any DNS records using either my domain provider or DNS Exit.

    I want to create proxies via Apache or direct via DNS (SRV Record?) from [Only registered and activated users can see links. ] to [Only registered and activated users can see links. ], but keep it cloaked so the port number doesn't show (not a redirect).

    Anyone able to give me an idiot's guide?

    Sent from my SM-G935F using Tapatalk

     
  2. Mr.James's Avatar

    Mr.James said:

    Default Re: DNS. Sub domain to Domain:port

    Windows or Linux? If linux, does it have to be apache? I do more or less same thing with nginx and there's next to nothing to it to get it going.
     
  3. DejaVu's Avatar

    DejaVu said:

    Default Re: DNS. Sub domain to Domain:port

    I'm using Linux and have managed to setup a reverse proxy, but the response time from the server (in a VM) is painful and takes ages for information to transfer the proxy.

    I'm now looking at ways to do it via DNS directly, using SRV? Or even URL Forwarding with cloaking.

    Are you using Nginx reverse proxy?

    Sent from my SM-G935F using Tapatalk

     
  4. Mr.James's Avatar

    Mr.James said:

    Default Re: DNS. Sub domain to Domain:port

    Yeah nginx is reverse proxying. I've not noticed any performance decrease at all.

    What linux distribution is it?
     
  5. DejaVu's Avatar

    DejaVu said:

    Default Re: DNS. Sub domain to Domain:port

    Linux Mint latest v17.3

    Sent from my SM-G935F using Tapatalk

     
  6. Mr.James's Avatar

    Mr.James said:

    Default Re: DNS. Sub domain to Domain:port

    add the following two lines to your /etc/apt/sources.list file


    Code: [View]
    deb http://nginx.org/packages/ubuntu/ trusty  nginx
    deb-src http://nginx.org/packages/ubuntu/ trusty  nginx

    download the nginx signing key:


    Code: [View]
    cd ~
    wget http://nginx.org/keys/nginx_signing.key .

    add the key to the db:


    Code: [View]
    apt-key add ~/nginx_signing.key

    update the list of installable apps:


    Code: [View]
    apt-get update

    install nginx:


    Code: [View]
    apt-get install nginx

    create the file for your website in /etc/nginx/conf.d/ for example mysite.conf


    Code: [View]
    server {
    
    
        server_name sub.domain.net;
    
    
        listen 80;
    
    
    #    access_log            /var/log/nginx/access.log;
    #    error_log             /var/log/nginx/error.log;
    
    
        location / {
    
    
          proxy_set_header        Host $host;
          proxy_set_header        X-Real-IP $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Forwarded-Proto $scheme;
          proxy_pass          http://domain.com:port/;
          proxy_read_timeout  90;
          proxy_redirect      off;
        }
    
    
    }

    then restart niginx


    Code: [View]
    service nginx restart
    That should get it working, could tweak a bunch of stuff, like add SSL at the proxy to encrypt everything coming from the back end, but leave that for another day lol
     
  7. DejaVu's Avatar

    DejaVu said:

    Default Re: DNS. Sub domain to Domain:port

    Spot on!! I'll give it a try. Means I'll have get rid of Apache first. It's currently listening on port 80.

    Sent from my SM-G935F using Tapatalk

     
  8. Mr.James's Avatar

    Mr.James said:

    Default Re: DNS. Sub domain to Domain:port

    Just change it to

    Code: [View]
    listen 81;
    and that way you can test that it's fast enough and that it handles the reverse proxying correctly before committing to removing your apache installation.