Vhosts no longer written to

Discussion in 'Installation/Configuration' started by whitty, Jun 30, 2006.

  1. whitty

    whitty New Member

    It appears that the vhosts file is no longer being written to by ispconfig upon a change in the configuration. I have no idea why, but I was completely unable to add another subdomain - it would go through fine in the bind side of things, but then there'd be no virtual host to take care of it on the apache end. When I backed up the vhosts file and made the real one blank then changed something in the web interface, the file was not restored as it normally would be, but was left blank, leaving me to wonder why ispconfig has stopped updating it.

    Any ideas would be greatly appriciated, and thanks for the great software and help!
     
  2. tosser

    tosser New Member

    copy the last backup like Vhosts_ispconfig.conf_29-04-06_16-51-40
    to Vhosts_ispconfig.conf then should ispconfig updating it
     
  3. till

    till Super Moderator

    Make a backup of Vhosts_ispconfig.conf

    Then copy back the latest Vhosts_ispconfig.conf with date appended and the execute:

    httpd -t

    to get the error message that prevents ISPConfig on updating your Vhosts_ispconfig.conf file.
     
  4. whitty

    whitty New Member

    i've figured out the problem, but no solution: as soon as I make a change, it writes to a new vhosts_ispconfig.conf file and immidiately thereafter appends the datestamp onto the end. It never even touches the straight file. For example: I added a bunch of junk characters to the front of the filenames currently in the folder (the straight file and one with a datestamp) so there was no straight file left. As soon as i made a change, it made the file, added all the correct data (except one bit- hold on) then as soon as it did that, added the datestamp, making it useless. The interesting thing is, in all the newly created files at the top under the ispconfig header bit, it used to add
    NameVirtualHost (myiphere):80
    <virtualhost (myiphere):80 and so on

    now it just adds
    (myiphere):80
    (myiphere):80

    I say myiphere because it was originally my public ip, but since i'm behind a nat router, i changed it to my private ip hardcoded into the template file. I did this so I could use my public ip as my default, so when new virtual hosts were created, they'd have the proper ip in their vhost entries, but the users could add domains which would use the proper public ip. anyway, thats not my problem, that's worked for weeks.

    and there are no syntax errors in httpd.conf

    Any ideas :(
     
  5. till

    till Super Moderator

    The beahviour you describe is absolutely OK, it means ISPConfig is working correctly.

    Never edit Vhosts_ispconfig.conf manually as this file is always overriden by ISPConfig!

    To figure out your httpd problem, please do exactly what i posted above:

    1) rename Vhosts_ispconfig.conf to Vhosts_ispconfig.conf.bak
    2) rename the latest Vhosts_ispconfig.conf file with a date appended to Vhosts_ispconfig.conf
    3) Execute:

    httpd -t

    and post the error message here.
     
  6. whitty

    whitty New Member

    it says that

    192.168.1.2:80 is an invalid command on line 8.

    192.168.1.2:80
    192.168.1.2:80

    is what appears directly after the commented header, instead of the

    NameVirtualHost 192.168.1.2:80
    <VirtualHost 192.168.1.2:80>
    ServerName localhost
    ServerAdmin root@localhost
    DocumentRoot /var/www/sharedip
    </VirtualHost>

    that always has. I've not edited this as such in the Vhosts_ispconfig.conf.master either.
     
  7. whitty

    whitty New Member

    once again, after pasting the correct vhost block over the

    192.168.1.2:80
    192.168.1.2:80

    bit and restarting apache, i make an edit in ispconfig and instead of editing vhost_ispconfig.conf it makes a new vhost_ispconfig.conf_(proper time stamp from seconds after the change here) and doesnt touch the former. The new file with the time stamp is yet again perfectly correct except for the

    192.168.1.2:80
    192.168.1.2:80

    bit where the vhost block should be.
     
  8. till

    till Super Moderator

    Which ISPConfig version do you use?

    This complete block is written at once, so I can not see how it shall be possible that only a part of it is included in the Vhost_ispconfig.conf when you use an unmodified ISPConfig version.
     
  9. whitty

    whitty New Member

    vhost.conf.master:
    {FP_RESOURCE_CONFIG}
    {FP_ACCESS_CONFIG}
    ###################################
    #
    # ISPConfig vHost Configuration File
    # Version 1.0
    #
    ###################################
    #
    <!-- BEGIN DYNAMIC BLOCK: namevhost -->
    192.168.1.2:80
    <!-- END DYNAMIC BLOCK: namevhost -->
    #
    #
    <!-- BEGIN DYNAMIC BLOCK: vhost -->

    ######################################
    # Vhost: {SERVERNAME}
    ######################################
    #
    #
    <VirtualHost 192.168.1.2:80>
    {HTTPD_INCLUDE}
    {SUEXEC}
    ServerName {SERVERNAME}
    ServerAdmin {SERVERADMIN}
    DocumentRoot {DOCUMENTROOT}
    {SERVERALIAS}
    {DIRECTORYINDEX}
    {CGI}
    ErrorLog {WEB_ERROR_LOG}
    {PHP}
    {SSI}
    {WAP}
    {ERRORALIAS}
    {ERROR}
    AliasMatch ^/~([^/]+)(/(.*))? {HTTPD_ROOT}/{WEB}/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? {HTTPD_ROOT}/{WEB}/user/$1/web/$3
    {REWRITE_RULE}
    {FRONTPAGE}
    </VirtualHost>
    #
    {SSL}
    #
    #
    <!-- END DYNAMIC BLOCK: vhost -->

    The only change I made to it was to replace {SERVERIP} with 192.168.1.2:80 in order to set my ip to the public one within ISPConfig so that automatically added bind records would have the proper public ip. That's it, and it's worked for many weeks until just recently.
     
  10. whitty

    whitty New Member

    even when i copy the newly created (timestamped) vhost.conf's contents into the proper Vhost_ispconfig.conf and let the

    192.168.1.2:80
    192.168.1.2:80

    block slide and therefore let apache fail to restart, it still won't write to that file on the next update
     
  11. falko

    falko Super Moderator

    What's in /root/ispconfig/isp/conf/vhost.conf.master?

    Can you post the contents of one of those Vhosts_ispconfig.conf with date appended?
     
  12. whitty

    whitty New Member

    vhost.conf.master - 2 posts up

    Vhost_ispconfig.conf_30-06-06_15-23-20:

    ###################################
    #
    # ISPConfig vHost Configuration File
    # Version 1.0
    #
    ###################################
    #
    192.168.1.2:80
    192.168.1.2:80
    #
    #
    ######################################
    # Vhost: www.whittyhost.us.to:80
    ######################################
    #
    #
    <VirtualHost 192.168.1.2:80>
    ServerName www.whittyhost.us.to:80
    ServerAdmin webmaster@whittyhost.us.to
    DocumentRoot /home/www/web1/web
    ServerAlias whittyhost.us.to admin.whittyhost.us.to www.whittyhost.us.to mail.whittyhost.us.to whittyhost.info admin.whittyhost.info mail.whittyhost.info www.whittyhost.info woot.whittyhost.us.to splunk.whittyhost.us.to
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias /cgi-bin/ /home/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /home/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode On
    php_admin_value open_basedir /home/www/web1/
    php_admin_value file_uploads 1
    php_admin_value upload_tmp_dir /home/www/web1/phptmp/
    php_admin_value session.save_path /home/www/web1/phptmp/
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    AddType application/vnd.wap.wmlscriptc .wmlsc .wsc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .ws .wmlscript
    AddType image/vnd.wap.wbmp .wbmp
    Alias /error/ "/home/www/web1/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /home/www/web1/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /home/www/web1/user/$1/web/$3
    # RewriteEngine on # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^admin\.whittyhost\.us\.to [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://admin.whittyhost.us.to:81/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^mail\.whittyhost\.us\.to [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://mail.whittyhost.us.to/roundcubemail/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^admin\.whittyhost\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://admin.whittyhost.us.to:81/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^mail\.whittyhost\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://mail.whittyhost.us.to:81/roundcubemail/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^www\.whittyhost\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://www.whittyhost.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^splunk\.whittyhost\.us\.to [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://splunk.whittyhost.us.to:8001/$1 [L,R] # NOT SUPPORTED!
    </VirtualHost>
    #
    #
    #
    ######################################
    # Vhost: www.whittyhost.dyndns.org:80
    ######################################
    #
    #
    <VirtualHost 192.168.1.2:80>
    ServerName www.whittyhost.dyndns.org:80
    ServerAdmin webmaster@whittyhost.dyndns.org
    DocumentRoot /home/www/web2/web
    ServerAlias www.whittyhost.dyndns.org m0n0wall.whittyhost.dyndns.org monowall.whitty.dyndns.org www.whitty.dyndns.org
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias /cgi-bin/ /home/www/web2/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /home/www/web2/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode On
    php_admin_value open_basedir /home/www/web2/
    php_admin_value file_uploads 1
    php_admin_value upload_tmp_dir /home/www/web2/phptmp/
    php_admin_value session.save_path /home/www/web2/phptmp/
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    AddType application/vnd.wap.wmlscriptc .wmlsc .wsc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .ws .wmlscript
    AddType image/vnd.wap.wbmp .wbmp
    Alias /error/ "/home/www/web2/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /home/www/web2/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /home/www/web2/user/$1/web/$3
    # RewriteEngine on # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^www\.whittyhost\.dyndns\.org [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://www.whittyhost.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^m0n0wall\.whittyhost\.dyndns\.org [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://m0n0wall.whittyhost.dyndns.org:444/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^monowall\.whitty\.dyndns\.org [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) https://m0n0wall.whittyhost.dyndns.org:444/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^www\.whitty\.dyndns\.org [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://www.whittyhost.us.to/$1 [L,R] # NOT SUPPORTED!
    </VirtualHost>
    #
    #
    #
    ######################################
    # Vhost: www.alexwhittemore.us.to:80
    ######################################
    #
    #
    <VirtualHost 192.168.1.2:80>
    ServerName www.alexwhittemore.us.to:80
    ServerAdmin webmaster@alexwhittemore.us.to
    DocumentRoot /home/www/web5/web
    ServerAlias blog.alexwhittemore.us.to alexwhittemore.us.to www.alexwhittemore.info blog.alexwhittemore.info www.awhittemore.info blog.awhittemore.info woah.alexwhittemore.us.to
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias /cgi-bin/ /home/www/web5/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /home/www/web5/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode Off
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    AddType application/vnd.wap.wmlscriptc .wmlsc .wsc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .ws .wmlscript
    AddType image/vnd.wap.wbmp .wbmp
    Alias /error/ "/home/www/web5/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /home/www/web5/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /home/www/web5/user/$1/web/$3
    # RewriteEngine on # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^www\.alexwhittemore\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://www.alexwhittemore.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^blog\.alexwhittemore\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://blog.alexwhittemore.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^www\.awhittemore\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://www.alexwhittemore.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^blog\.awhittemore\.info [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*) http://blog.alexwhittemore.us.to/$1 [L,R] # NOT SUPPORTED!
    # RewriteCond %{HTTP_HOST} ^woah\.alexwhittemore\.us\.to [NC] # NOT SUPPORTED!
    # RewriteRule ^/(.*)$ http://www.alexwhittemore.us.to/woah/$1 [R] # NOT SUPPORTED!
    </VirtualHost>
     
  13. falko

    falko Super Moderator

    The file must look like this:

    Code:
    {FP_RESOURCE_CONFIG}
    {FP_ACCESS_CONFIG}
    ###################################
    #
    # ISPConfig vHost Configuration File
    #         Version 1.0
    #
    ###################################
    #
    <!-- BEGIN DYNAMIC BLOCK: namevhost -->
    [B][COLOR="Red"]{SERVERIP}[/COLOR][/B]
    <!-- END DYNAMIC BLOCK: namevhost -->
    #
    #
    <!-- BEGIN DYNAMIC BLOCK: vhost -->
    
    ######################################
    # Vhost: {SERVERNAME}
    ######################################
    #
    #
    <VirtualHost {IP}>
    {HTTPD_INCLUDE}
    {SUEXEC}
    ServerName {SERVERNAME}
    ServerAdmin {SERVERADMIN}
    DocumentRoot {DOCUMENTROOT}
    {SERVERALIAS}
    {DIRECTORYINDEX}
    {CGI}
    ErrorLog {WEB_ERROR_LOG}
    {PHP}
    {SSI}
    {WAP}
    {ERRORALIAS}
    {ERROR}
    AliasMatch ^/~([^/]+)(/(.*))? {HTTPD_ROOT}/{WEB}/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? {HTTPD_ROOT}/{WEB}/user/$1/web/$3
    {REWRITE_RULE}
    {FRONTPAGE}
    </VirtualHost>
    #
    {SSL}
    #
    #
    <!-- END DYNAMIC BLOCK: vhost -->
    It seems you edited the file... :rolleyes:
     
  14. whitty

    whitty New Member

    I know, that's what I said - i changed that manually to facilitate a solution for easier domain record managment for customer-level users on a server behind NAT. the solution worked for at least a month until this happened, through many changes. I guess i'll try making that template 100% default then going back through and making my changes once it works again :p Thanks for sticking with me through this issue!
     
  15. whitty

    whitty New Member

    I've solved it!

    To all those running ISPConfig behind a NAT router (i suggest talking to me directly anyway, but if your just doing it on your own :)):

    Originally (with ispconfig ver. 2.2.2): I wanted to set the ip addresses for all my vhost sites as my public address since that when customer users added codomains, they'd be entered into the system with the ip address that would properly resolve - the public one. That also results, however, in the apache vhost being set with the public ip, and it wont listen on the only ip actually open to it, the local one. Now you'll notice that the individual site vhosts arent the only ones in Vhost_ispconfig.conf - theres another up at the top that directs queries to the ip itself to the "shared ip" page. This also needs to be set to the proper local ip address. In version 2.2.2, what i did was

    1. replace {SERVERIP} in that top block under "begin dynamic block namevhost" with my local ip "192.168.1.2:80". I then went through the rest of the file and found another ip variable for all the other vhost blocks. I then

    2. changed the {IP} variable after <virtualhost in that next block to my local ip again "192.168.1.2:80". Having done that, my entire conf file was set to my local ip, meaning nothing i did on the ispconfig side of things would mess up my apache configuration while it would still allow me to add/remove vhosts and redirects and the like. Not changing the ip wasn't a problem because even if i added a new public ip somehow, my private ip still wouldnt change.

    in version 2.2.3 however, my best guess is that {SERVERIP} changed to holding the entire

    NameVirtualHost ip:80
    <VirtualHost ip:80>
    ServerName localhost
    ServerAdmin root@localhost
    DocumentRoot /var/www/sharedip
    </VirtualHost>

    block instead of just the ip. This meant that it broke my system, and it now placed

    192.168.1.2:80
    192.168.1.2:80

    where the proper block should have been. Note that my edit of {IP} in the VirtualHost block didn not break.

    The soluion was simply to add a random localhost holder site in ispconfig with the ip address 192.168.1.2. This way, ISPConfig recognizes that that ip is used and adds a proper block before it instead of the junk string above (which causes apache start to fail) It still maintains the block with the public ip as well, but all that matters is that it now has the local ip too.

    If you need any more help on these lines, post here or email me at galexyalex [at} gmail {dot] com
     
  16. falko

    falko Super Moderator

    The behaviour hasn't changed in 2.2.3...
     

Share This Page