Virtual Host (vhost file) reset after updating web domain configuration

Discussion in 'Installation/Configuration' started by jaypabs, Jun 18, 2013.

  1. jaypabs

    jaypabs New Member

    After editing website configuration using ISPConfig 3, under Sites tab > website, the vhost file created by ISPConfig was reset automatically to it's default value.

    All the custom config that I added was lost.

    Example I set the following line to:

    Code:
            server_name mysite.com www.philnews.ph;
    
            root   /var/www/mysite.com/web;
    
            index index.php index.htm index.html index.cgi index.pl index.xhtml;
    
    Now, when I update the site "mysite.com, the vhost reset to default like:

    Code:
            index index.html index.htm index.php index.cgi index.pl index.xhtml;
    
    Notice the php file will move again to the 3rd location.

    Note that this happen to anything that you change in the web domain config like changing the password of "Webstatistics" under statistics tab.

    How to prevent this?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, thats intended. The vhost files made by ispconfig shall not be altered manually. If you want to add any apache code to a vhsot file, use the apache directives field on the options tab of the website settings.
     
  3. jaypabs

    jaypabs New Member

    Can you please give me an example of directives on how to change the order of index? Like I want to make index.php the first index rather than index.html.

    BTW, I'm using Nginx.

    Thank you
     
  4. ItsDom

    ItsDom New Member

    Login as admin, go to sites, select the domain, go to the options tab, add your directives in the "nginx directives"

    I've found in the past that putting directives not in some kind of location container can cause conflicts, so try this:

    Code:
    location / {
       index index.php index.htm index.html index.cgi index.pl index.xhtml;
    }
    

    I think you need to be logged in as admin though for the "options" tab to be visible.
    At the risk of thread hi-jacking: does anyone know if it is possible to allow clients to view and change options?
     
  5. jaypabs

    jaypabs New Member

    That works, but is this a good practice? Because the old index is not removed above. This make two index.
     
  6. ItsDom

    ItsDom New Member

    I'm not sure it's "good practice" but it's the advised way of doing it by people that know a lot (http://www.howtoforge.com/forums/showpost.php?p=290382&postcount=4)

    I think it's to do with a quirk in how ISPConfig synchronizes/updates the vhosts files.

    I THINK it effectively has a vhosts template which has things such as root, index, directives to get php working etc. When synchronizing, ISPConfig basically just adds the directives from the options field into the template without actually changing the template. If you look at the thread I link to in the first paragraph here, when I didn't put the "root" directive in a location container, there were complaints because there were 2 root directives at the same level suggesting it was just appending the root directive to the template, rather than updating bits within the template.

    This maybe wrong, or a gross over-simplification but that seems to be how it works. I'm sure someone will correct me:)
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats not possble as it would allow your clients to take over your server.

    Yes, thats ok.
     
  8. jaypabs

    jaypabs New Member

    Thanks for the reply.

    I have another question about how to override the error_page. My wordpress site has its own error handling. By default, it is embedded in wordpress. So how can I remove error_page in the nginx directive?
     
  9. ItsDom

    ItsDom New Member

    Go into ISPConfig control panel, select the site, under the "domain tab" untick the "Own Error-Documents" should really do it... not sure if that removes the error handling totally from nginx or just point it to a global set of error pages though... Give it a try.
     
  10. jaypabs

    jaypabs New Member

    My bad. I did not notice it. It actually removes the error handling.

    thanks
     

Share This Page