Results 1 to 10 of 10

Thread: How is vsftpd configured to support multiple web sites?

  1. #1
    Join Date
    Jun 2008
    Location
    UK; deep south, far below Watford.
    Posts
    275

    Default How is vsftpd configured to support multiple web sites?

    Swerdna kindly provided me a prototype vsftpd configuration to allow me to use vsftp and 'put' files from DreamWeaver to a web-server running under Apache2 on a Linux machine.That configuration worked immediately. To identify the web site to be used, this configuration file has the entry 'local_root=srv/www/htdocs/<web-site-name>'.

    Clearly this supports a single web-site only. I have read widely into vsftpd, vsftpd.conf, xinetd and xinetd,conf and examined the web article 'Linux Internet Web Server & Domain Configuration Tutorial' to see if I can understand where multiple web-site names could be specified. The above material seems to point me at a file chroot_list in /etc/vsftpd - but this seems to contain only a list of users who are local to the Apache server computer. That's not what I want - but I can't seem to find further information.

    Any advice?
    They said I wasn't fit to live with a pig; my brother stood up for me and said I was.

  2. #2
    Join Date
    Jul 2008
    Location
    Voorhout, Netherlands
    Posts
    262

    Default Re: How is vsftpd configured to support multiple web sites?

    XEyedBear wrote:
    > Swerdna kindly provided me a prototype vsftpd configuration to allow me
    > to use vsftp and 'put' files from DreamWeaver to a web-server running
    > under Apache2 on a Linux machine.That configuration worked immediately.
    > To identify the web site to be used, this configuration file has the
    > entry 'local_root=srv/www/htdocs/<web-site-name>'.
    >
    > Clearly this supports a single web-site only. I have read widely into
    > vsftpd, vsftpd.conf, xinetd and xinetd,conf and examined the web article
    > 'Linux Internet Web Server & Domain Configuration Tutorial' to see if I
    > can understand where multiple web-site names could be specified. The
    > above material seems to point me at a file chroot_list in /etc/vsftpd -
    > but this seems to contain only a list of users who are local to the
    > Apache server computer. That's not what I want - but I can't seem to
    > find further information.


    Just start multiple servers with 'vsftpd <configuration file>' and put
    the wanted config for your sites in those files.
    Of course you can't have more that one server bound to the same address
    and port, so you'll have to make sure the listening addresses are different
    in each config.

    The FTP servers should be resolvable in a name server if you want to
    reach the separate servers by name.

  3. #3
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: How is vsftpd configured to support multiple web sites?

    You can run multiple web servers (with only one ethernet card) by using a series of virtualHost config files (.conf files) in the directory /etc/apache2/vhosts.d. You can access each of them with ftp addresses that use their domain names.

    Suppose you have bear.com and cat.com and an IP of 192.168.0.44 on your server's card. Switch your primary document root from /srv/www/htdocs over to /home on the server as follows.

    Make an account on the server for a user called bear and another for a user named cat.

    Change the root entry in vsftpd.conf to this:
    Code:
    local_root=/home/
    Change the entry in default-server.conf to something like this:
    Code:
    ServerName bears_lair
    NameVirtualHost 192.168.0.44
    ServerAdmin bear@lair.net
    
    DocumentRoot "/home"
    <Directory "/home">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    Make a virtual server for cat.com in directory vhosts.d called maybe cat.conf something like this:
    Code:
    # file:///etc/apache2/vhosts.d/cat.conf
    <VirtualHost 192.168.0.44>
     ServerName www.cat.com
     ErrorLog /var/log/apache2/caterrors.txt
     DocumentRoot /home/cat/public_html
    
     <Directory "/home/cat/public_html">
      Options *whatever you like*
      blah blah
      AllowOverride All
      Order allow,deny
      Allow from all
     </Directory>
    
    ScriptAlias /cgi-bin/ /home/cat/public_html/cgi-bin/
    <Directory "/home/cat/public_html/cgi-bin">
    	AllowOverride None
    	Options +ExecCGI -Includes
    	Order allow,deny
    	Allow from all
    </Directory>
    
    </VirtualHost>
    That defines a document root for www . cat . com located at /home/cat/public_html

    Do another like cat but for bear.

    Do as many as you like, all off of the same NIC, with an individual doc root like /home/username/public_html for each domain name.

    Luck
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  4. #4
    Join Date
    Jun 2008
    Location
    UK; deep south, far below Watford.
    Posts
    275

    Default Re: How is vsftpd configured to support multiple web sites?

    Quote Originally Posted by LittleRedRooster View Post
    Just start multiple servers with 'vsftpd <configuration file>' and put the wanted config for your sites in those files.
    Of course you can't have more that one server bound to the same address and port, so you'll have to make sure the listening addresses are different
    in each config.
    Right now my single copy of vsftpd.conf is started automatically at boot (following recommendation in the man pages), but if I create multiple conf files, how can they be automatically started? It's not a big deal, if I have only 3 or 4 of these, to type 3 or 4 command lines, but it's not every elegant. I assume there must be a Linux equivalent of a Windows Autoexec.bat file? If so, must it have a special name and be located in a special place, just like "good" old DOS?


    I got the impression that this was the sort of task that xinetd was designed to do (but couldn't understand how to do it).

    The FTP servers should be resolvable in a name server if you want to reach the separate servers by name.
    Could you explain what is meant by 'resolvable' and 'name server'. Is this something I would have to build for myself?
    They said I wasn't fit to live with a pig; my brother stood up for me and said I was.

  5. #5
    Camalen NNTP User

    Default Re: How is vsftpd configured to support multiple web sites?

    XEyedBear wrote:

    > Swerdna kindly provided me a prototype vsftpd configuration to allow me
    > to use vsftp and 'put' files from DreamWeaver to a web-server running
    > under Apache2 on a Linux machine.That configuration worked immediately.
    > To identify the web site to be used, this configuration file has the
    > entry 'local_root=srv/www/htdocs/<web-site-name>'.
    >
    > Clearly this supports a single web-site only. I have read widely into
    > vsftpd, vsftpd.conf, xinetd and xinetd,conf and examined the web article
    > 'Linux Internet Web Server & Domain Configuration Tutorial' to see if I
    > can understand where multiple web-site names could be specified. The
    > above material seems to point me at a file chroot_list in /etc/vsftpd -
    > but this seems to contain only a list of users who are local to the
    > Apache server computer. That's not what I want - but I can't seem to
    > find further information.


    Check the online documentation for this:

    ftp://vsftpd.beasts.org/users/cevans.../VIRTUAL_HOSTS

    Greetings,

    --
    Camalen

  6. #6
    Join Date
    Jun 2008
    Location
    UK; deep south, far below Watford.
    Posts
    275

    Default Re: How is vsftpd configured to support multiple web sites?

    These last 2 replies have been inteersting thanks. I'm trying to decide which will be the more practical for my installation. That requires understanding these 2 approaches better.

    The article referred to in the previous post talks about a server being able to respond to 2 IP addresses (and therefore ebing able to service requests to 2 web-site names). How is this done? I had thought that all systems on a LAN receive all message placed on the LAN, but respond only to those with the correct address. I had further thought (with no evidence to support my faith) that this address was the MAC and that only one IP could be associated with a MAC. So if I want 2 IPs, don't I need 2 ethernet devices and 2 cables?

    On the other hand I notice that there are 2 declarations for the IP address for localhost in my hosts file: 127.0.0.1 and 127.0.0.2 - so maybe a single computer system can have multiple IP addresses - but where are they specified? There is, as far as I can see, no way to enter this in Yast->Network Settings.
    They said I wasn't fit to live with a pig; my brother stood up for me and said I was.

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How is vsftpd configured to support multiple web sites?

    Quote Originally Posted by XEyedBear View Post
    The article referred to in the previous post talks about a server being able to respond to 2 IP addresses (and therefore ebing able to service requests to 2 web-site names). How is this done? I had thought that all systems on a LAN receive all message placed on the LAN, but respond only to those with the correct address. I had further thought (with no evidence to support my faith) that this address was the MAC and that only one IP could be associated with a MAC. So if I want 2 IPs, don't I need 2 ethernet devices and 2 cables?

    On the other hand I notice that there are 2 declarations for the IP address for localhost in my hosts file: 127.0.0.1 and 127.0.0.2 - so maybe a single computer system can have multiple IP addresses - but where are they specified? There is, as far as I can see, no way to enter this in Yast->Network Settings.
    There's no problem at all binding multiple addresses to an Ethernet interface. All that happens is that when another computer needs to know who has an IP address using ARP (Address Resolution Protocol) the target computer will respond with its MAC address if that address is one of those it has.

    To bind additional addresses, go to Network Devices > Network Settings, select an Ethernet device, Edit and it's there under Additional Addresses.

  8. #8
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: How is vsftpd configured to support multiple web sites?

    @ken_yap: do multiple IP based hosts require the ISP to allocate multiple IPs to do this job, or is it some sort of forwarding exercise to get the incoming requests routed to the appropriate IP to service the request?

    It seems to me that name-based vhosts is simpler if the traffic is sub-enterprise.

    I run five websites on the one IP address. They invented "name-based virtual hosts" for this purpose. Have I missed something? (I think not, but better to check).
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How is vsftpd configured to support multiple web sites?

    There could be various reasons why a host has multiple IPs. If it has multiple interfaces, then it would have multiple IPs and is multihomed. Routers for example, are multihomed.

    However I assume you are referring to multiple IP addresses on a single interface. If there is no NAT, and the addresses are public, then you just bind multiple addresses to the interface and it just works, because of ARP. If it is behind NAT, then you have to create multiple NATs.

    For most intents, an interface with multiple addresses bound to it will work just like multiple interfaces each with their own address. Of course the gross bandwidth is that of the single interface.

  10. #10
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: How is vsftpd configured to support multiple web sites?

    Thanks ken_yap
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •