ns1. open /var/www/html but ns2. redirect to domain name

Discussion in 'Installation/Configuration' started by lonerunner, Jul 29, 2023.

  1. lonerunner

    lonerunner Member

    I have the following settings:

    2 Ip's on the server and they are:
    192.168.1.1 ns1.website.com
    192.168.1.2 ns2.website.com

    In hosts file I have them both added:
    127.0.0.1 localhost.localdomain localhost
    192.168.1.1 ns1.website.com ns1
    192.168.1.2 ns2.website.com ns2

    In hostname which would be server name I have only
    ns1.website.com

    The website is hosted on this server and in ISPConfig I have the setup of the website, ns1 and ns2 as subdomains and I also have one alias domain for this website.
    So in .vhost file on both port 80 and port 443 I have:
    ServerName website.com
    ServerAlias www.website.com
    ServerAlias ns1.website.com
    ServerAlias ns2.website.com
    ServerAlias website.rs
    ServerAdmin [email protected]

    And this all seems fine, the only thing I remember a while ago, I made changes to apache default.conf file to include virtualhost on port 443 to open /var/www/html page. This is because when domain is suspended or doesn't have ssl by default apache redirect to first available domain and I wanted to prevent this.
    I don't remember I made any other changes but it looks like ns1.website.com is opening that page /var/www/html while ns2.website.com is redirecting to website.com
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    ns1.website.com is also the hostname of the server?

    i believe then that /var/www/html is being loaded when the ns1.website.com url is being requested, as it will successfully match against the default vhost first anyway.
    the actual hostname should not be used for a website vhost in an ispconfig system anyway. this will likely cause issues with letsencrypt certificates between the ispconfig panel and services and the vhost.

    your vhost should really just be using website.com and www.website.com, there really isn't any usual reason to connect to a website using the nameservice subdomains.
    you may, in this case, have a specific reason for it, but you haven't indicated any.

    also, hopefully this is just a test / trial server, i assume you have both ns1 and ns2 subdomains has your domain registrar required you to provide two different fqdn and ip's. but you really shouldn't have them both pointing to the same server.. they shouldn't even be on the same network and ideally not even the same geographical location. if anything happens to the bind9 service on this server, your entire dns, for all the domains you run your own dns service for, will be unavailable to anyone. you can get away with it for testing.. but in a production environment it's a definite no-no.
     
    lonerunner likes this.

Share This Page