merging of nginx vhost configuration not working

Discussion in 'ISPConfig 3 Priority Support' started by harkman, Jul 18, 2017.

  1. harkman

    harkman New Member HowtoForge Supporter

    Hello.
    For some time now I have continued problems with changes made in the nginx directives in the options tab of the website.
    Every time I edit the vhost / website configuration and save it, I get an error email that Nginx was not able to restart. Even on very small changes that result in no big change, like changing the php version, I get the nginx restart error. When I diff the vhost and vhost.err files the only change might be the randomised string in the \.php$ location rule. I can delete the old .vhost file and rename .vhost.err to .vhost and Nginx -t will give no error.
    What is wrong here?
    Additionally, I noticed that the ##merge## Tags do not work in my Nginx directives, and if I put a location rule into the nginx directives it will not overwrite the rule of the vhost template file, but put a duplicated location rule in my .vhost file resulting in a real error.
    I'm really stuck here. Why is the merging of the nginx directives and the nginx restart not working properly?
    I use a conf-custom/nginx_vhost.conf.master maybe this is causing it. How can I debug this problem? Any way to get some debug output when ISPconfig tries to build my .vhost files?
    Update: I disabled my conf-custom/nginx_vhost.conf.master temporarily but the nginx restart issue still exists. The merging problem seems therefore related to my custom vhost template.
     
    Last edited: Jul 18, 2017
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The problem is most likely related to the custom bginx directive sthat you have in the nginx directives field of the options tab. Try to empty that field and save to see if the issue is gone then. If thats the case, then you must have entered something that ispconfig and nginx do not support in that field.
     
  3. harkman

    harkman New Member HowtoForge Supporter

    Disabled config-custom/nginx_vhost.conf.master
    removed all nginx directives from website config.
    Saved -> nginx restart error
    As previously stated, the vhost.err files are absolutely OK. I can rename them and nginx -t will give me no error. I do not understand why ISPconfig fails to test the .vhost file. Is there anything going on in between testing the new .vhost file and moving it to .vhost.err?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You can use the debug mode to find out more.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    You can use the debug mode to find out more.
     
  6. harkman

    harkman New Member HowtoForge Supporter

    How do I do this? I set the $conf['log_priority'] = 0; in server/lib/config.inc.php but this did not log anything regarding the generation of the nginx vhost configuration. Any other location to look into?
     
  7. harkman

    harkman New Member HowtoForge Supporter

    18.07.2017-12:25 - WARNING - Reason for nginx restart failure: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    restart: Unknown instance:
    restart: Unknown instance:​
    Does this mean ISPconfig cannot detect the running instance id?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig is using the normal system commands to restart services, when the restart fails, then it switches back to the last working config. The error message about instance ID is not coming from ISPConfig, it is coming from the nginx start script or systemd, depending on your init system. When systems is installed, then ISPConfig will use it to restart services, otherwise the init script is used.

    Just a guess, maybe you have systemd and init scripts installed. When you then use the init script for a manual restart or start, then systemd will fail to restart the service. So when systemd is installed as init system, then only systemd should be used.
     
  9. harkman

    harkman New Member HowtoForge Supporter

    Distributor ID: Debian
    Description: Debian GNU/Linux 7.11 (wheezy)
    Release: 7.11
    Codename: wheezy

    no systemctl but "service nginx start/stop" is working.
    @till you were right. If I use /etc/init.d/nginx for restarting I get the restart error. When I use service nginx start the instance id is properly created and ISPconfig will do a clean nginx restart.
     

Share This Page