Redirect only shows main site

Discussion in 'General' started by Alvaro Gomes, Oct 13, 2019.

Tags:
  1. Alvaro Gomes

    Alvaro Gomes New Member

    Hi all,
    What I'm going to say here probably has been answered before, as I already did a search about the subject. Here is the scenario:
    * We have a primary domain abc.net (e.g). So when I create a website, I link the website to that domain. This is working.
    * Problem: If we add another site (e.g example1.abc.net) the NGINX do not show the correct folder of that site, only shows the main site directory, which is abc.net.

    I've been trying to figure out how to do this, I've also tested all variations of solutions I could get, but not results. So I'm asking here if anybody could help me with this, any help will be appreciated.

    Alvaro
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Use Internet Search Engines with
    Code:
    site:howtoforge.com wrong site shown
    Read the threads until you find the misconfiguration in your setup. Your problem is very common.
    I'm not familiar with nginx being an Apache user.
     
  3. Alvaro Gomes

    Alvaro Gomes New Member

    Like I said before, I've tried all the solutions I could get, some of which was found exactly in the search engines over internet.
    Look, I really appreciated your help, thanks in advance
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    What you describe happens when:

    a) You mix up IP and * in the website settings. Choose IP or * for all sites but don't mix it.
    b) Not all sites on a specific IP have SSL, which means ssl requests for the site that has no SSL enabled get redirected to the ssl site.
    c) The website config was not written at all.
     
  5. Alvaro Gomes

    Alvaro Gomes New Member

    Hi till,

    When you say this, what mean exactly? I'm sorry I'm noobie in ISPConfig, but I've been working with IT Infrastructure for years, and to be honest I didn't take too much time to learn some aspects of webservers, and for me this is really a new thing. Like, I've created the default domain 000default.tld like you said in another thread, and I've checked that all hosts uses www instead of * Also, I've checked /etc/nginx/sites-available/ and I can see all the vhost.err files and none of them starts with 900-, which is about the 'auto-subdomain' section.

    Also, I'm made sure I got the correct wildcard ssl certificate loaded on both sites (main site and secondary site) but still no results.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    When you see files with .err ending, then the config could not be written as nginx rejected to start with that config. You said you used a wildcard ssl cert, then this might be the cause. E.g. you used a wrong cert or a cert format not understood by nginx or you entered the wrong key for the cert or you added a password-protected key which means apache could not decode it and therefore failed to start.

    The above assumes that your server was installed correctly in general e.g. by using one of our perfect server install guides.
     
  7. Alvaro Gomes

    Alvaro Gomes New Member

    But the idea behind wildcard ssl certs is to make sure any website which as a valid dns record and is resolvable by internet have a ssl cert, right? Btw I've used the same ca-bundle, crt, csr and key file on all sites. Is my assumption wrong?

    Another information is that this install uses nginx as webserver.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    That's partuially right, a wildcard ssl cert is for subdomains only though. So it will cover *.domain.tld where * is any subdomain. But your problem is not about what a wildcard cert is used for, I'm talking about a technical problem which causes nginx to fail, it won't fail if you insert a cert for a completely wrong domain but it will fail if cert and key don't match or if you use a cert format not supported by nginx.
     
    Alvaro Gomes likes this.
  9. Alvaro Gomes

    Alvaro Gomes New Member

    But the nginx is working right now, as I mentioned before the main site is working and is pointing to the right folder. Back before we had a problem on limits which was solved, but ever since the nginx didn't fail to start
     
  10. Alvaro Gomes

    Alvaro Gomes New Member

    Let me ask you this: the main domain (example.test) is supposed to be created under the 'sites' section? I mean, when you add a website, the default should looks like www.example.test under the 'domain' section? I think I'm getting it now, but this piece of information is vital for me to understand how ispconfig dynamics
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Correct, it is working because the issue in the config was detected and the last working config was reverted. If ISPConfig would not revert the config, then Nginx incl. ispconfig ui would not be accessible anymore now.

    There is no such thing as a main domain, all domains are equal. But it is standard for web servers to enter the domain and not a subdomain in the domain field, so you would enter example.test in the domain field and then select auto subdomain: www if you want to www subdomain. Only if this site is for a subdomain like shop.yourdomainötld only, then you would enter shop.yourdomain.tld in the domain field.

    But that's all not related to your problem, so let's come back to your issue as you will not get a working server when you don't solve it.
    Go to the ssl tab, empty all fields, select 'delete certificate' in the action field and press save. then wait until the red dot in the nav bar disappears. Now check in the sites-available folder if the .err file is gone now for this site. If its gone, then you know that a wrong ssl cert caused the issue.

    if the .err file is still there, then rename the .vhost file of this site to .vhost.bak, the .vhots.err file to .vhost and restart nginx. It will probably fail now with an error and this error is the reason why the config can not be saved.
     
    Alvaro Gomes likes this.
  12. Alvaro Gomes

    Alvaro Gomes New Member

    I'll try this and will come back short. Thanks in advance!
     
  13. Alvaro Gomes

    Alvaro Gomes New Member

    The only error I got is this one in /var/log/nginx/error.log:

    emerg] 11393#11393: open() "/var/log/ispconfig/httpd/company22.example.test/access.log" failed (24: Too many open files)
    2019/10/14 15:12:02 [emerg] 29955#29955: open() "/var/log/ispconfig/httpd/company22.example.test/access.log" failed (24: Too many open files)
    2019/10/14 15:18:01 [emerg] 30346#30346: open() "/var/log/ispconfig/httpd/company23.example.test/access.log" failed (24: Too many open files)
    2019/10/14 15:26:01 [emerg] 30991#30991: open() "/var/log/ispconfig/httpd/company23.example.test/access.log" failed (24: Too many open files)
    2019/10/14 17:57:01 [emerg] 9463#9463: open() "/var/log/ispconfig/httpd/company24.example.test/access.log" failed (24: Too many open files)
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Google for the error 'Too many open files' and reconfigure your Linux system so that it does not hit file limits.
     

Share This Page