PDA

View Full Version : Apache virtual hosts!?!


bss
12th December 2006, 17:07
HI!
My problem is:
I have a domain called oblika.si and
when I enter the this address (http://oblika.si or http://www.oblika.si) ito the browser I get my apache server default document root(/) insted of (/web11/web/). When I enter the IP address into my browser it doesn't point to shared ip page but to default server root... so I had an a problem becouse I have configured my apache settings (in isp config) wrong - apache2.conf insted of httpd.conf.

So I installed webmin on my server and looked to my apache virtual hosts configuration.

my /etc/apache2/vhosts/Vhosts_ispconfig.conf look like that:
###################################
#
# ISPConfig vHost Configuration File
# Version 1.0
#
###################################
#
NameVirtualHost 84.255.204.201:80
<VirtualHost 84.255.204.201:80>
ServerName localhost
ServerAdmin root@localhost
DocumentRoot /var/www/sharedip
</VirtualHost>
#
#
######################################
# Vhost: www.oblika.si:80
######################################
#
#
<VirtualHost 84.255.204.201:80>
ServerName www.oblika.si:80
ServerAdmin webmaster@oblika.si
DocumentRoot /var/www/web11/web
ServerAlias oblika.si webmail.oblika.si
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/ /var/www/web11/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ErrorLog /var/www/web11/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 /var/www/web11/
php_admin_value file_uploads 1
php_admin_value upload_tmp_dir /var/www/web11/phptmp/
php_admin_value session.save_path /var/www/web11/phptmp/
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/var/www/web11/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 ^/~([^/]+)(/(.*))? /var/www/web11/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web11/user/$1/web/$3
</VirtualHost>
#
#
#

But i think this is one of the problem causing things:

<VirtualHost 84.255.204.201:80>
And I tried to change this line to <VirtualHost _default_:80>
and then it worked...but...ISP config configs this as <VirtualHost 84.255.204.201:80>
and if there is a solution to config this in ISPconfig becouse in need perfect setup for multi domain hosting and i dont want to change every apache virtual host by hand....and i think tha ISPconfig creates IP based virtual hosts in apache insted of name based virtual hosts!!!

Thank you for all in advance!

P.S.:
My DNS settings are OK.

till
13th December 2006, 11:01
Is your server behind a router? Then you must select the internal IP address, not the external. By the way, never edit Vhosts_ispconfig.conf manually, it is not nescessary and it wont work for long.

bss
13th December 2006, 15:05
yes... i am behind an IP cop firewall and figure it out that ISP creats IP based virtual host insted of name based...thanks again
But then I need to manualy edit the DNS settings to my external IP :(

till
13th December 2006, 21:40
ISPConfig creates only namebased virtual hosts, not IP based. When you are behind a roter, you will have to set the external IP for the DNS records manually.

hairydog2
17th December 2006, 15:40
I am in the process of moving many domains from one IP to another on the same server.

It would be very much easier for me if I could have :

######################################
# Vhost: {SERVERNAME}
######################################
#
#
<VirtualHost {SERVERNAME}>

instead of :

######################################
# Vhost: {SERVERNAME}
######################################
#
#
<VirtualHost {IP}>

in vhost.conf.master

Would that cause any problems somewhere else?

till
18th December 2006, 08:30
You will have to change the ISPConfig code and it might work, but I've not tested that.

There is a easier way to change the IP of a lot of websites. Change the IP in the ISPConfig database in the table isp_isp_web and set the value of the field staus = 'u', then update and safe one website in the interface and all websites will be changed.

hairydog2
18th December 2006, 12:13
That sounds like a better bet for the number I have to change. Thank you.

Would that also change the DNS, or would I have to do that separately?

The reason I wanted to use names for the web server is that whatever you do, changing the web server IP and the IP in the DNS will mean that some people will go to the "wrong" IP and not get through, depending on how long the DNS change takes to spread out.

till
18th December 2006, 12:42
You will have to change the DNS separately. Change the IP addresses in the database tables dns_a and dns_isp_dns. then set the field status = 'u' in the table dns_isp_dns for all records that shall be updated. Then update one DNS record in the interface and all records with status = 'u' will be updated.