Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG 11 Kigali, Rwanda May 2010 Dorcas Muthoni Courtesy: Hervey Allen.

Slides:



Advertisements
Similar presentations
WEB AND WIRELESS AUTOMATION connecting people and processes InduSoft Web Solution Welcome.
Advertisements

A digression The next feature of programming HTTP clients that we will consider is user authentication Before considering that, however, we will digress.
Dan Fleck.  WAMP – Windows Apache MySQL PHP -  LAMP – Linux Apache MySQL PHP ◦ There are.
Apache Web Server Quick and Dirty Steve Gibbard for SANOG 16 (Originally by Joel Jaeggli for AfNOG 2007) ‏
Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let.
Chapter Apache Installation in Linux- Mandrake. Acknowledgment The following information has been obtained directly from
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
Apache : Installation, Configuration, Basic Security Presented by, Sandeep K Thopucherela, ECE Department.
SSL (Secure Socket Layer) and Secure Web Pages Rob Sodders, University of Florida CIS4930 “Advanced Web Design” Spring 2004
SquirrelMail for Webmail AfNOG 2012 Scalable Internet Services (SS-E) Presented by Michuki Mwangi Serrekunda, Gambia (Original Materials by Joelja)
APACHE SERVER By Innovationframes.com »
SquirrelMail for Webmail AfNOG 2013 Scalable Internet Services (SS-E) Presented by Michuki Mwangi Lusaka, Zambia (Original Materials by Joelja)
Virtual Hosts The apache server can handle multiple “web sites” at a time – a web service provider company may have multiple different sites to offer (see.
Linux Operations and Administration
Setting up Greenstone for your organization Course material prepared by Greenstone Digital Library Project University of Waikato, New Zealand andNational.
Hosted Exchange The purpose of this Startup Guide is to familiarize you with ExchangeDefender's Exchange and SharePoint Hosting. ExchangeDefender.
Appendix: Installing AMP (Apache + MySQL + PHP). Training Course, CS, NCTU 2 AMP  AMP A – Apache Web Server M – MySQL Database Server P – PHP Language.
Web Server Configuration Alokes Chattopadhyay Computer & Informatics Centre IIT Kharagpur.
The Linux Operating System Lecture 5: Apache Tonga Institute of Higher Education.
System Administration
Web Servers1-1 Web Servers Xingquan (Hill) Zhu
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
An introduction to Apache. Different Types of Web Servers Apache is the default web server for may Unix servers. IIS is Microsoft’s default web server.
Apache httpd Web Server C. Edward Chow. Advanced Internet & Web Systems chow2 Outline of the Talk Introduction to Apache httpd web server Basic Compilation,
Apache, PHP, MySQL Installation and configuration Web Programming with PHP,TITAS PROJECTIICT,BUET.
System Administration NFS & Web Servers. NFS SERVER.
Web Services CSCI N321 – System and Network Administration Copyright © 2007,2008 by Scott Orr and the Trustees of Indiana University.
Set 13: Web Servers (configuration and security) (Chapter 21) IT452 Advanced Web and Internet Systems.
1 Apache and Virtual Sites and SSL Dorcas Muthoni.
User authentication, passwords
Hands On Networking Network Applications Ram P Rustagi, ISE Dept Kundan Kumar, MCA Dept Manini Sahoor, MCA Dept Ravi Teja, MCA Dept Sourav.
Apache Web Server Quick and Dirty for AfNOG 2015 (Originally by Joel Jaeggli for AfNOG 2007) ‏
Cosc 4750 Configuring httpd, Mysql, And Samba. defaults By default httpd demean will startup and work User directories are turned off Default directory.
Apache Web Server Quick and Dirty Evelyn NAMARA for AfNOG 2014 (Originally by Joel Jaeggli for AfNOG 2007) ‏
Turning Windows 7 into a Web Server Ch 28. Understanding Internet Information Services.
1 Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG X Cairo, Egypt May 2009 Hervey Allen.
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
Apache Web Server Quick and Dirty Kevin G. Chege for AfNOG 2013 (Originally by Joel Jaeggli for AfNOG 2007) ‏
LinuxChix Apache. Serving Webpages The layer 7 protocol (HTTP) is what our browsers talk to get us the websites we can't seem to live without. HTTP is.
WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages.
Authentication Names and Passwords Names and Passwords Also can use Groups Also can use Groups Webmaster can “require” authentication Webmaster can “require”
Web Technology – Web Server Setup : Chris Uriarte Meeting 4: Advanced Topics, Continued: Securing the Apache Server and Apache Performance Tuning Rutgers.
Web Server (Apache httpd ) 1. 2 Apache Web Server A PAtCHy server: developed by the Apache group History- First.
Web Server Administration Chapter 6 Configuring a Web Server.
CITA 310 Section 5 Virtual Hosts and Virtual Directories (Selected Topics from Textbook Chapter 6)
APACHE -By V.Gouthaman. The Apache HTTP Server, commonly referred to as Apache is web server software notable for playing a key role in the initial growth.
Web Server Apache PHP HTTP Request User types URL into browser Address resolved if nec. We use directly Most browsers request.
(ITI310) By Eng. BASSEM ALSAID SESSIONS 10: Internet Information Services (IIS)
SquirrelMail for Webmail Quick and Dirty Michuki Mwangi for AfNOG 2010.
Free Powerpoint Templates Page 1 Free Powerpoint Templates Chapter 4- Server Configuration.
CITA 310 Section 4 Apache Configuration (Selected Topics from Textbook Chapter 6)
XAMPP.
Multi-Domain Hosting CPTE 212 “Missing Slides” for 1/22/2015 John Beckett.
NX Documentation Using Windows IIS (Internet Information Services) as a http server for NX documentation.
Secure Authentication A Brief Overview PacNOG 6 Workshop Nadi, Fiji Hervey Allen.
Building Your Own Website Using:. Install & configure LAMP. Download WordPress and run it as a local website on your Raspberry Pi. Configure WordPress.
Web Server Administration Chapter 6 Configuring a Web Server.
Apache Configuration. Application Install IBM HTTP Server is Apache.
1 E-Site - FTP Services Setup / install guide. 2 About FTP services can run on any desired port(s) Runs as a windows service Works for all sites installed.
Apache web server Quick overview.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess
Authentication & .htaccess
SquirrelMail for Webmail
Enhanced Web Site Design Stanford University Continuing Studies CS 22
Unix System Administration
Unix System Administration
(Originally by Joel Jaeggli for AfNOG 2007)‏
System Administration Homework 4 – Web Server
APACHE WEB SERVER.
Web Servers (IIS and Apache)
Presentation transcript:

Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG 11 Kigali, Rwanda May 2010 Dorcas Muthoni Courtesy: Hervey Allen

What is Apache? Very good overview here: The Apache web site is an excellent source of information as well:

Quick Facts Initially released in 1995 Used on over 100 million web sites 54% market share. Microsoft is 25%. One million busiest sites, Apache 66.82%, Microsoft 16.87% Cross platfrom: Runs on Unix, Linux, FreeBSD, Solaris, Netware, Mac OS X, Windows, OS/2 and more. Licensed under the Apache License. Incompatible with GPL version 2, compatible with version 3.

May 2010 Statistics f

What is a Virtual Host? There are two types:  Name-based  IP-based We will be configuring named-based virtual hosts. This allows a single IP address to serve many web sites from a single server. This is possible because the web client sends the name of the site it wishes to connect to as part of its initial connection request.

Issues Originally with HTTP/1.0 headers the hostname was not required to be included. Some browsers, notably Internet Explorer did not include the site name. This caused name-based hosting to fail. HTTP/1.1 released in 1999 requires the hostname to be part of the header. So, this is no longer an issue. SSL fails with name-based hosting as the hostname is not part of the initial TLS/SSL handshake – thus you cannot match the correct certificate to use for each site.

IP-based Hosting This requires a separate IP address for each hostname on a web server. IP-based hosting works with current SSL implementations. IP-based hosting (can) work even if DNS has failed. However, requires an IP address for each site. This may not be possible and requires more effort to implement.

Configuration Details: Apache Primary Configuration file/usr/local/etc/apache22/httpd.conf Where your website files are stored DocumentRoot Default is usually "/usr/local/www/apache22/data” File that Apache will serve if a directory is requested DirectoryIndex Default is usually index.html Others can be index.php or index.htm etc Listen portListen 80 You can also bind apache to a port, IP or both e.g. Listen :80 Supplemental configurationThe configuration files in the etc/apache22/extra/ directory can be included to add extra features or to modify the default configuration Include etc/apache22/extra/httpd-vhosts.conf

Configuration Considerations: Apache Directory naming conventions. Decide upon one from the start:  /usr/local/www/share/??(FreeBSD)  /var/www/share/??(Linux) What to do about default actions? We'll give an example in our exercises. Must deal with directory permissions in more detail.

Questions? ?

Other Popular Apache Items Three include:  aliases  mod_rewrite  htaccess

Aliases Allows you to specify a web directory name that maps to a separate directory outside the file structure of a web site. For example: Your site is The site resides in /usr/local/www/share/default/, but you want the files in /usr/local/www/books/ to be available at How would you do this?

Aliases continued In the file httpd.conf... Alias /books /usr/local/www/share/books But, you must set Directory permissions as well. For instance: Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Remember, case counts in Apache configuration files!

mod_rewrite Allows you to redirect requests from a page, or a pattern of pages to another page, or another pattern of pages. Extremely powerful Uses regular expression language Can save you if In order to use mod_rewrite the rewrite module must be part of your Apache install (it is in FreeBSD 8.0 and Apache 2.2), and it must be loaded in the httpd.conf file: LoadModule rewrite_module modules/mod_rewrite.so

mod_rewrite continued Here is some sample code where mod_rewrite is actually used (from httpd.conf ): # turn on the use of the mod_rewrite module RewriteEngine on # Redirect old style ISO=NN requests RewriteRule ^\/db\/lookup\/ISO=([A-Z]) \ /db/lookup/redirect.php The end result of this is the redirect reforms the requests in to the form: or \ id= &fromISO=eg

htaccess Perhaps the most common use of mod_rewrite is to force the use of https for a set of pages – such as a site login page. Here is an example: # Turn on the rewrite engine. # If we are not using port 443 (ssl) AND # We are trying to access something under the /trac directory AND # We are NOT trying to open the initial index.php file (to avoid # infinite redirects), THEN keep the URI and force the user to use # SSL. Too many passords and sensitve info are thrown around on # the trac project pages. RewriteEngine on RewriteCond %{SERVER_PORT} !443 RewriteCond %{REQUEST_URI} ^/trac RewriteCond %{REQUEST_URI} !^/trac/index.php RewriteRule ^(.*)$ [R=301]

htaccess continued Then you must create a file “.htaccess” in the directory you wish to protect. In that file you might have something like this: AuthName "AfNOG 2010 SAE, Trac Access" AuthType Basic AuthUserFile /var/www/html/trac/afnog10/.htpasswd require user afnog Note the file “.htpasswd ” above. This is where you store user/password information. You do this by running and using the htpasswd command.

htpasswd command To create an initial.htpasswd file with a user and password you do: # htpasswd -c.htpasswd username The “-c” parameter says to create the file. Enter in the password when prompted. For the next user do: # htpasswd.htpasswd username To change a password just run the command again. And, in the end you'll see a prompt like this...

htaccess Questions?