I hope to host multi virtual servers on one dedicated server. their domain are a.com b.com c.com which use same ip.
DocumentRoot at /home/a/public_html /home/b/public_html /home/c/public_html
ftp root /home/a/ /home/b/ /home/c/
below are what I did
in virtualmin, create virtual server named a.com b.com c.com
edit httpd.conf
vi /etc/httpd/conf/httpd.conf
< virtualHost *:80 >
DocumentRoot /home/a/public_html/
ServerName *.a.com
ServerAlias *.a.com
ServerAlias a.com
< /VirtualHost >
< virtualHost *:80 >
DocumentRoot /home/b/public_html/
ServerName *.b.com
ServerAlias *.b.com
ServerAlias b.com
< /VirtualHost >
< virtualHost *:80 >
DocumentRoot /home/c/public_html/
ServerName *.c.com
ServerAlias *.c.com
ServerAlias c.com
< /VirtualHost >
3.restart apache, it display
[warn] default VirtualHost overlap on port 80, the first has precedence
but when I input a.com b.com c.com in web browser,
all are led to a.com rather than a.com b.com c.com
Your comment welcome
Try using the IP address instead of "*" in the VirtualHost directives. Apache has some quite complex rules when determining which virtual host to serve, and it's best to be as specific as possible in VirtualHost. That's what Virtualmin does too by default, and correctly; how come you had to edit http.conf at all?
[warn] VirtualHost 50.23.16.18:80 overlaps with VirtualHost 50.23.16.18:80, the first has precedence, perhaps you need a NameVirtualHost directive
I do not what does this mean
I checked http.conf
DocumentRoot is /var/html
and not virtual host site info
I created the virtual servers in VirtualMin.
and check the http.conf
it did not change the DocumentRoot and add the virtual host info, so I added.
just wonder
if name-based virtual host http://httpd.apache.org/docs/2.4/vhosts/name-based.html
and virtual server are same thing?
Virtualmin doesn't put the new servers into the main httpd.conf file, but in the sites-available subfolder.
Hi Locutus!
Note that on CentOS, it actually does add the entries to the httpd.conf file.
Virtualmin tries to "go with the flow" regarding how a given distribution works... both Debian and Ubuntu use the /etc/apache2/sites-available/ dirs, with individual .conf files.
On CentOS, each individual VirtualHost entry is added to the end of the httpd.conf file, as CentOS doesn't use the sites-available directory (even though I kind of which it would!)
-Eric
[root@server1 home]# cd /etc/apache2/sites-available/ -bash: cd: /etc/apache2/sites-available/: No such file or directory
even I changed
virtualHost *:80 to virtualHost 1.2.3.4:80 (1.2.3.4 is actual ip)
very thing is same.
All access for a.com b.com c.com are led to a.com
You should try recreating the virtual servers, and not mess with the httpd config. :) Virtualmin normally does this all okay, and if it doesn't for you, there's something else wrong.
If you delete and re-create the servers, and don't edit the config, what's the exact problem?
I removed all virtual sites , remove apache and reinstall virtualmin
yum -y remove httpd yum -y install file yum -y install patch yum -y update wget http://software.virtualmin.com/gpl/scripts/install.sh sh ./install.sh
log:
Welcome to the Virtualmin GPL installer, version 1.1.0
WARNING:
The installation is quite stable and functional when run on a freshly installed supported Operating System.
If you have existing websites, email users, or if you manually installed Virtualmin via a Webmin 'wbm' module, you are likely to run into problems. Please read the Virtualmin Administrators Guide before proceeding if your system is not a freshly installed and supported OS.
This script is not intended to update your system! It should only be used to perform your initial Virtualmin installation. If you have previously run the Virtualmin installer, you can perform upgrades and updates from within Virtualmin itself, or using your system's package manager. Once Virtualmin is installed, you never need to run this script again.
The systems currently supported by install.sh are: CentOS and RHEL 5-6 on i386 and x86_64 Scientific Linux 6 on i386 and x86_64 Debian 6.0 and 7.0 on i386 and amd64 Ubuntu 8.04 LTS and 10.04 LTS, and 12.04 LTS on i386 and amd64 Amazon Linux 2012.03 on i386 and x86_64 FreeBSD 7.0 and 8 on i386 and amd64
If your OS is not listed above, this script will fail. More details about the systems supported by the script can be found here:
http://www.virtualmin.com/os-support.html
Continue? (y/n) y Checking for HTTP client...found /usr/bin/curl -s -O Checking for perl...found /usr/bin/perl Loading log4sh logging library... INFO - Started installation log in /root/virtualmin-install.log INFO - Checking for fully qualified hostname... INFO - Hostname OK: fully qualified as server1.kaisatec.com INFO - Installing serial number and license key into /etc/virtualmin-license INFO - Loading OS selection library... INFO - Download of http://software.virtualmin.com/lib/oschooser.pl Succeeded. INFO - Loading OS list... INFO - Download of http://software.virtualmin.com/lib/os_list.txt Succeeded. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). INFO - Operating system name: CentOS Linux INFO - Operating system version: 6 INFO - Configuring package manager for CentOS Linux 6... INFO - Disabling SELinux during installation... /usr/sbin/setenforce: SELinux is disabled INFO - setenforce 0 failed: 1 INFO - Download of http://software.virtualmin.com/gpl/rhel/6/x86_64/virtualmin-release-late... Succeeded. Running updatedb so locate works...this will take a little while. Attempting to import various system RPM-GPG-KEY files...Errors may occur, if you've already imported them. It is safe to ignore these errors. /var/tmp/rpm-tmp.iAEKUM: line 30: [: Failed to set locale, defaulting to C 3: integer expression expected /var/tmp/rpm-tmp.iAEKUM: line 33: [[: Failed to set locale, defaulting to C 3: syntax error in expression (error token is "to set locale, defaulting to C 3") INFO - Succeeded. INFO - Installing dependencies using command: /usr/bin/yum -y -d 2 install bind bind-utils caching-nameserver httpd postfix spamassassin procmail perl-DBD-Pg perl-DBD-MySQL quota iptables openssl python mailman subversion mysql mysql-server mysql-devel postgresql postgresql-server rh-postgresql rh-postgresql-server logrotate webalizer php php-xml php-gd php-imap php-mysql php-odbc php-pear php-pgsql php-snmp php-xmlrpc php-mbstring mod_perl mod_python cyrus-sasl dovecot spamassassin mod_dav_svn cyrus-sasl-gssapi mod_ssl ruby ruby-devel rubygems perl-XML-Simple perl-Crypt-SSLeay mlocate ...in progress, please wait... -Failed to set locale, defaulting to C |Warning: RPMDB altered outside of yum. INFO - /usr/bin/yum -y -d 2 install bind bind-utils caching-nameserver httpd postfix spamassassin procmail perl-DBD-Pg perl-DBD-MySQL quota iptables openssl python mailman subversion mysql mysql-server mysql-devel postgresql postgresql-server rh-postgresql rh-postgresql-server logrotate webalizer php php-xml php-gd php-imap php-mysql php-odbc php-pear php-pgsql php-snmp php-xmlrpc php-mbstring mod_perl mod_python cyrus-sasl dovecot spamassassin mod_dav_svn cyrus-sasl-gssapi mod_ssl ruby ruby-devel rubygems perl-XML-Simple perl-Crypt-SSLeay mlocate: Succeeded. INFO - Succeeded. INFO - Installing Virtualmin and all related packages now using the command: INFO - yum clean all Failed to set locale, defaulting to C Loaded plugins: fastestmirror, security Cleaning repos: base extras rpmforge updates virtualmin virtualmin-universal Cleaning up Everything Cleaning up list of fastest mirrors INFO - yum -y -d 2 install virtualmin-base ...in progress, please wait... -Failed to set locale, defaulting to C INFO - yum -y -d 2 install virtualmin-base: Succeeded. INFO - Checking for updates to Virtualmin-related packages... ...in progress, please wait... -Failed to set locale, defaulting to C INFO - /usr/bin/yum -y -d 2 install bind bind-utils caching-nameserver httpd postfix spamassassin procmail perl-DBD-Pg perl-DBD-MySQL quota iptables openssl python mailman subversion mysql mysql-server mysql-devel postgresql postgresql-server rh-postgresql rh-postgresql-server logrotate webalizer php php-xml php-gd php-imap php-mysql php-odbc php-pear php-pgsql php-snmp php-xmlrpc php-mbstring mod_perl mod_python cyrus-sasl dovecot spamassassin mod_dav_svn cyrus-sasl-gssapi mod_ssl ruby ruby-devel rubygems perl-XML-Simple perl-Crypt-SSLeay mlocate: Succeeded. INFO - Updating SpamAssassin rules... perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). INFO - Rule updates done [root@server1 ~]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
then I created 2 virtual servers.
a.com b.com
I checked /home/
there are 2 directory 'a','b'
when use ftp connect, it will lead to /home/a and /home/b I uploaded file to /home/a/public_html and /home/b/public_html via ftp.
but in /etc/httpd/conf/httpd.conf it wrote
DocumentRoot "/var/www/html"
Options FollowSymLinks AllowOverride None
when I input a.com b.com to web browser and go
it only displayed
Index of /
[ICO] Name Last modified Size Description
it looks like I am led to /var/www/html rather than /home/a/public_html and /home/b/public_html
[root@server1 home]# cd /etc
[root@server1 etc]# ls
ConsoleKit ftpusers named.rfc1912.zones redhat-release DIR_COLORS ftpusers.rpmsave named.root.key resolv.conf DIR_COLORS.256color gai.conf nanorc rndc.key DIR_COLORS.lightbgcolor gcrypt networks rpc GeoIP.conf gnupg nsswitch.conf rpm GeoIP.conf.default group ntp rsyslog.conf NetworkManager group- ntp.conf rsyslog.d X11 grub.conf odbc.ini rwtab abrt gshadow odbcinst.ini rwtab.d acpi gshadow- openldap sasl2 adjtime gtk-2.0 opt scl aliases hal pam.d scponly aliases.db host.conf pango securetty alsa hosts passwd security alternatives hosts.allow passwd- selinux anacrontab hosts.deny pcmcia services apt httpd pear sestatus.conf asound.conf init pear.conf setuptool.d at.deny init.d php.d shadow audisp inittab php.ini shadow- audit inputrc php.ini-zend_optimizer.bak shells awstats iproute2 php.ini.ctohome.com skel bash_completion.d iscsi pinforc smart bashrc issue pki smartd.conf blkid issue.net plymouth smrsh centos-release kdump-adv-conf pm snmp chkconfig.d kdump.conf pm-utils-hd-apm-restore.conf sos.conf clamd.conf krb5.conf polkit-1 ssh cron.d ld.so.cache popt.d ssl cron.daily ld.so.conf portreserve statetab cron.deny ld.so.conf.d postfix statetab.d cron.hourly lftp.conf ppp subversion cron.monthly libaudit.conf prelink.cache sudo-ldap.conf cron.weekly libreport prelink.conf sudo.conf crontab libuser.conf prelink.conf.d sudoers crypttab localtime printcap sudoers.d csh.cshrc login.defs procmailrc sysconfig csh.login logrotate.conf profile sysctl.conf dbus-1 logrotate.d profile.d system-release default lvm proftpd.conf system-release-cpe depmod.d magic proftpd.conf.rpmnew terminfo dhcp mail protocols udev dovecot mail.rc quotagrpadmins updatedb.conf dracut.conf mailcap quotatab usermin dracut.conf.d mailman rc vimrc environment makedev.d rc.d virc ethers man.config rc.local virtualmin-license event.d mime.types rc.sysinit warnquota.conf exports mke2fs.conf rc0.d webalizer.conf favicon.png modprobe.d rc1.d webmin filesystems motd rc2.d wgetrc fonts mtab rc3.d xdg fprintd.conf my.cnf rc4.d xinetd.d freshclam.conf named rc5.d yum freshclam.conf.rpmnew named.conf rc6.d yum.conf fstab named.iscdlv.key readahead.conf yum.repos.d
there is no directory 'apache2' of course, there is no directory '/etc/apache2/sites-available/' neither
cd /etc/apache2
-bash: cd: /etc/apache2: No such file or directory
Uh-oh. Trying to "reinstall Virtualmin" by running the installer script again is... problematic. Not recommended for sure. The installer script is meant primarily to be used on a fresh OS.
So at this point, I guess it'd be better to reinstall the OS and try again. :) Of course, Eric might have some further input on this, CentOS indeed isn't my area of expertise. (Yes, I keep forgetting there are distros besides Debian/Ubuntu, which do things differently, like the httpd.conf bit. :) )
I think the problem is
I used ensim before, when I added a new site, there was option for 'add ip-based site' or and 'add named-base site'.
But in virtualmin , there is no such option.
how to make the created new vitual server for name-based?
Virtualmin uses name-based virtual hosts by default, when you have your server's IP address configured as "shared IP", which Virtualmin also does automatically by default.
Normally, you don't have to do anything besides create the server, and Virtualmin takes care of creating a proper VirtualHost block.
Did you install Virtualmin on a fresh system, or over existing things?
it is not a pure os I have installed something I do not hope to re-install os
I will check if the problem can be fixed
Howdy,
If Apache isn't configured to perform Name-based virtual hosting for your IP address, you may need to set that up.
That would normally be configured for you by default, when running the installer on a fresh system, but it's possible that didn't work properly in your case since it wasn't a fresh system.
To do that, you'd just need to add a line like this to your httpd.conf:
NameVirtualHost x.x.x.x:80
Where "x.x.x.x" is your server's IP address.
Also, note that there are some troubleshooting steps for the issue you're seeing here in the section "the wrong website shows up":
https://www.virtualmin.com/documentation/web/troubleshooting
I just purchased a vps server on linode with fresh os. I will checked if the problem still existes