Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up OpenVZ to divide several of my sites from each other. I have one external ip address which I use to serve my sites. I'm using nginx to proxy http requests to nginx in each container which then proxies them to apache or fast-cgi and serves it's static content. I want to have something similar to nginx for FTP to proxy requests to corresponding FTP server inside container based on it's hostname. Is virtual hosting possible in FTP protocol based on DNS hostname?

P.S. for sure I can setup corresponding path to /vz/private/.... in FTP server's configuration on global zone but it's not very elegant solution. What are the best practices for shared hosting?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You cannot redirect FTP traffic by the site's domain name because FTP does not run over HTTP. Fortunately there is WebDAV - a replacement for FTP which does runs over HTTP. WebDAV just is a standard but many web servers implement it. For example Apache has mod_dav.

It seems that using Nginx is a bit complicated for proxying WebDAV: http://blog.agoragames.com/2009/03/20/webdav-nginx-play-nice/

I did it with Pound (an HTTP front-end) and it was simple.

Here is how my Pound config file looks.

# WebDAV
ListenHTTP

  Address mylab.edu
  Port    818

  xHTTP     3

  Service
    HeadRequire "^Host: anotherlab\.edu:818$"
    BackEnd
      Address openvzhost1
      TimeOut 60
      Port    818
    End
  End

  Service
    HeadRequire "^Host: anotherlab2\.edu:818$"
    BackEnd
      Address openvzhost1
      TimeOut 60
      Port    818
    End
  End
End

Don't run the FTP server on the head node. That's probably not very secure.

The best practice is not to run any services on the OpenVZ head node.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.