web hosting for fame and fortune a guide to using apache as your web-server solution
TRANSCRIPT
![Page 1: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/1.jpg)
Web Hostingfor Fame and Fortune
A Guide to using Apacheas your web-server solution
![Page 2: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/2.jpg)
Why use Apache?
Extremely portable Completely Open Source Proven track-record Most popular web server on the
planet Support available from informal
and formal channels
![Page 3: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/3.jpg)
Picking the Server Hardware
Fast Pentium class server Load up on ECC RAM (at least
128M) Fast Disks Choose a 10/100Mbps Ethernet
card Tape Backup UPS
![Page 4: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/4.jpg)
Picking the OS
Best Choice is an Open Source OS
East of Installation Hardware support Robustness and Reliability Personal “comfort level” We prefer FreeBSD
![Page 5: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/5.jpg)
Downloading Apache
Grab the tarball from www.apache.org or the closest mirror
$ lynx http://www.apache.org/dist
Decompress the tarball$ gunzip apache_1.3.x.tar.gz
De-tar the tarball$ tar xvf apache_1.3.x.tar
![Page 6: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/6.jpg)
Building Apache
Determine the modules you want– Basic Apache modules– 3rd party module (mod_php)
Configure or configure?– First time? Use configure– Need suEXEC? Use configure– Like command line? Use Configure
![Page 7: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/7.jpg)
Useful Modules
mod_php– Adds very powerful server-side scripting
language (<? echo “<b>Hi World</b>”; ?>)– Fast performer and easy to learn– Provides access to various SQL databases– Most popular module for Apache– http://www.php.net/
![Page 8: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/8.jpg)
Useful Modules
mod_macro– Streamlines complex conf files
<Macro MyVirtualHost $host $port $dir>Listen $port<VirtualHost $host:$port>DocumentRoot $dir</VirtualHost></Macro>Use MyVirtualHost www.apache.org 80 /projects/apache/webUse MyVirtualHost www.perl.com 8080 /projects/perl/web
– http://www.cri.ensmp.fr/~coelho/mod_macro/
![Page 9: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/9.jpg)
Useful Modules
mod_vhost_alias– Perfect when using hundreds/thousands of
vhosts– Allows for real-time addition of new vhosts
without server restarts– Smaller memory footprint– Cons:
• No individual log files• Not as comprehensive as true <VirtualHost>• Somewhat slower
![Page 10: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/10.jpg)
Useful Modules
mod_perl– Embeds a true Perl interpreter to Apache– Most Perl scripts work with little
modification– MUCH faster performance for "CGI"– Can write Apache modules completely in
Perl– http://perl.apache.org/
![Page 11: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/11.jpg)
Performance Issues - Platform
Have plenty of RAM Use SCSI if you can Use separate SCSI buses Set aside swap space Tune the Operating System
(kernel) Dedicate server to Apache
![Page 12: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/12.jpg)
Performance Issues - Platform
Don’t allow shell access Don’t use for development Adjust number or size of:
– File descriptors (fstat)– Mbufs (netstat)– Process slots (maxusers & CHILD_MAX)– Listen queue (SOMAXCONN)– Available RAM (vmstat)
![Page 13: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/13.jpg)
Performance Issues - Apache
Tune basic directives– MinSpareServers– MaxSpareServers– StartServers– MaxClients / HARD_SERVER_LIMIT– MaxRequestsPerChild– ThreadsPerChild
![Page 14: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/14.jpg)
Performance Issues - Apache
AllowOverride / htaccess– Causes expensive "stat" for each
directory– Set AllowOverride None at top directory
Disable DNS lookups– Latency effects perceived speed of site
Mutex locking (optimal)
![Page 15: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/15.jpg)
Performance Issues - Apache
Trim memory usage– Modules
• mod_status / ExtendedStatus Off
• mod_info
– DSO
Trim cycle usage– mod_status / ExtendedStatus Off
– mod_rewrite
![Page 16: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/16.jpg)
Performance Issues - Apache
Avoid unneeded I/O– Logging (LogLevel)– Content (mod_mmap_static)– Logs on separate drive/bus
Ensure KeepAlives are active– KeepAlive On– KeepAliveTimeout– KeepAliveRequests
![Page 17: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/17.jpg)
Security Issues - Platform
Also effect performance: Win Win! Keep up to date No shell / no cleartext passwords FTP setup Disable unneeded daemons
– sendmail / smail / qmail
– The "r" family– tftpd
![Page 18: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/18.jpg)
Security Issues - Apache
Run server as unprivileged user– Use a dedicated account
Log files and PID file locations– Avoid file overwrites
Protecting file access– Symbolic links and DocumentRoot
Monitor the server and Apache
![Page 19: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/19.jpg)
Security Issues - Apache
Protect sensitive information– mod_status and mod_info– <Location /.status>
SetHandler server-statusorder deny,allowdeny from allallow from 192.168.103.10</Location>
– <Location /.status><Limit GET>SetHandler server-statusrequire valid-user</Limit></Location>
![Page 20: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/20.jpg)
Security Issues - Apache
Protect about the risks of multiple users and CGI scripts– cgiwrap
• CGI scripts are run as the actual "user"• Prevents against users over-writing others
files• "Limits" location of cgi-scripts• http://www.umr.edu/~cgiwrap/
– suEXEC• Allows for per-vhost user/group
![Page 21: Web Hosting for Fame and Fortune A Guide to using Apache as your web-server solution](https://reader031.vdocuments.site/reader031/viewer/2022013003/5513d5215503466f748b4eb7/html5/thumbnails/21.jpg)
Thank you !
Q&A That's all folks!