mass virtual hosting with apache 2 0
play

Mass Virtual Hosting with Apache 2.0 Paul Querna - PowerPoint PPT Presentation

Mass Virtual Hosting with Apache 2.0 Paul Querna chip@OutOfOrder.cc Virtual Hosts IP Address Required for HTTPS The 'Host' Header Mass Virtual Hosting? HTTPD's Default configuration doesn't deal well with thousands of


  1. Mass Virtual Hosting with Apache 2.0 Paul Querna chip@OutOfOrder.cc

  2. Virtual Hosts ● IP Address – Required for HTTPS ● The 'Host' Header ● Mass Virtual Hosting? – HTTPD's Default configuration doesn't deal well with thousands of Virtual Hosts!

  3. Considerations ● Security – Suexec? – PHP? – Perchild? – Root? ● Performance – Hits/Second – Memory ● Maintainable – You have to Administrate it!

  4. Logging ● Standard log files? – Multiple Server? – Thousands of Virtual Hosts? – 'Split Later' ● Piped Logging ● mod_log_spread

  5. Static Vhosts ● httpd.conf ● Include vhosts.d/*.conf – foo.bar.com.conf

  6. Advantages ● Speed – No special lookup methods ● Configuration – Every Directive is available

  7. Problems ● Scripting? – mod_macro lessens the complexity ● Requires Graceful Restarts – Add A Vhost – Change a Vhost ● Wasted Memory – Many sites are rarely ● Multiple Servers? ● Root? – How can you edit or script the configuration files? – Restarting Apache?

  8. mod_rewrite ● Using a RewriteMap: RewriteMap lowercase int:tolower RewriteMap vhost txt:/etc/httpd/conf/vhost.map RewriteCond %{HTTP_HOST} !^$ RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]

  9. Advantages ● Speed – Fast Lookups -- To a Point! ● Easy to add a Virtual Host

  10. Problems ● Security? – PHP? – Suexec? ● Multiple Servers? ● Root? – Edit RewriteMap File

  11. mod_vhost_alias ● Uses the host header to determinate the filename: VirtualDocumentRoot /vhosts/%0 ● Use Symlinks for ServerAliases?

  12. Advantages ● Easy to Setup ● Fast! – No external lookups ● Based on file system layout – Can be shared across servers.

  13. Problems ● Security? – Suexec – Can work – PHP ● Root? – Changing a file system?

  14. mod_vhost_dbi ● Uses a LibDBI database to provide information about a Vhost. mod_vhost_dbi mod_dbi_pool libdbi MySQL Postgres Oracle SQLlite

  15. mod_dbi_pool PoolDbiDriver Server1 mysql PoolDbiHost Server1 10.0.0.20 PoolDbiUsername Server1 myuser PoolDbiPassword Server1 mypass PoolDbiDBName Server1 vhost_dbi PoolDbiConnMin Server1 1 PoolDbiConnSoftMax Server1 1 PoolDbiConnHardMax Server1 5 PoolDbiConnTTL Server1 30

  16. mod_vhost_dbi <VirtualHost *:80> VhostDbiEnabled On VhostDbiConnName Server1 VhostDbiQuery “SELECT ServerName, DocumentRoot, UserName FROM VhostInfo WHERE ServerName = ''&{RequestHostname}” </VirtualHost>

  17. Advantages ● Security – Suexec – PHP OpenBaseDir ● Not Perfect! ● Root? – No Need ● No Configuration Files to Change ● No Server to Restart

  18. Problems ● Depends on a Database Server – Performance Implications – Uptime?

  19. Resources ● Slides, mod_vhost_dbi: – http://www.outoforder.cc/ ● Virtual Hosts: – The Apache Documentation! ● http://httpd.apache.org/docs-2.0/vhosts/

  20. Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend