Apache & Virtual Hosts & mod_rewrite



Similar documents
The course will be run on a Linux platform, but it is suitable for all UNIX based deployments.

Installing an SSL certificate on the InfoVaultz Cloud Appliance

APACHE WEB SERVER. Andri Mirzal, PhD N

Setup a Virtual Host/Website

SVNManager Installation. Documentation. Department of Public Health Erasmus MC University Medical Center

Installing Apache Software

Created by : Ashish Shah, J.M. PATEL COLLEGE UNIT-5 CHAP-1 CONFIGURING WEB SERVER

Security Issues in Web Programming. Robert M. Dondero, Ph.D. Princeton University

How to Install Multicraft on a VPS or Dedicated Server (Ubuntu bit)

1 of 24 7/26/2011 2:48 PM

While are you still in Nagios working directory, create a new file for DNS servers monitoring

orrelog Apache TLS / Crypto Enhanced Encryption Software

Integration Guide. SafeNet Authentication Service. SAS Using RADIUS Protocol with Apache HTTP Server

HOW TO BUILD A VMWARE APPLIANCE: A CASE STUDY

Apache Usage. Apache is used to serve static and dynamic content

What will be supplied with chemoventory package?

Host your websites. The process to host a single website is different from having multiple sites.

Setting Up A Nagios Monitoring System Warren Block, May 2005

SSL, Load Balancers, Rewrite, Redirect, and More Advanced Configuration

Apache Server Implementation Guide


Setting up an Apache Web Server for Greenstone 2 Walkthrough

Apache Security with SSL Using Linux

TECHNICAL NOTE Stormshield Network Firewall AUTOMATIC BACKUPS. Document version: 1.0 Reference: snentno_autobackup

To enable https for appliance

Implementing HTTPS in CONTENTdm 6 September 5, 2012

Virtual Host (Web Server)

APACHE HTTP SERVER 2.2.8

Apache2 Configuration under Debian GNU/Linux. Apache2 Configuration under Debian GNU/Linux

Tonido Cloud Admin Guide

Web Server: Principles and Configuration Web Programming 8) Web Server

Web Site Content Management Server. Installation Guide Version 4.1 Build 0

Configuring Apache and IIS for High Availability Web Server Clustering

Name-based SSL virtual hosts: how to tackle the problem

Shibboleth SP Simple Installation Guide For LINUX

How To Create A Ticketing System With Rt.Org

Guide to Web Hosting in CIS. Contents. Information for website administrators. ITEE IT Support

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System

Startup guide for Zimonitor

Technical specification

Tibbr Installation Addendum for Amazon Web Services

Active Directory Integration for Greentree

Network Monitoring Systems / Nagios. 2/19/08 Michael Miller e mail: mike.mikemiller@gmail.com

PassMark Software BurnInTest Management Console. Quick start guide

Lepide Active Directory Self Service. Configuration Guide. Follow the simple steps given in this document to start working with

Semantic based Web Application Firewall (SWAF - V 1.6)

SecuritySpy Setting Up SecuritySpy Over SSL

Managing Software Projects Like a Boss with Subversion and Trac

Web Page Redirect. Application Note

Kollaborate Server Installation Guide!! 1. Kollaborate Server! Installation Guide!

Magento Security Best practices 2015

Elluminate Live! Access Guide. Page 1 of 7

INUVIKA OVD INSTALLING INUVIKA OVD ON RHEL 6

Talk Internet User Guides Controlgate Administrative User Guide

Release Notes Date: September 2013


Setting up a Web Server using Raspbian Wheezy on the Raspberry Pi ( Kenneth A Spencer)

How To Run Nrpe On Nagios On Windows 7.5 (Windows) On A Linux Computer On A Windows 7 (Windows 7) On An Ubuntu Computer On An Ipad Or Ipad (Windows 8) On Your Pc

Real Vision Software, Inc.

APACHE. Presentation by: Lilian Thairu

Single sign-on websites with Apache httpd: Integrating with Active Directory for authentication and authorization

Contents. 1. Infrastructure

Apache 2.0 Installation Guide

Installing Dspace 1.8 on Ubuntu 12.04

INTRODUCTION AND TERMINOLOGY

User Manual. (updated December 15, 2014) Information in this document is subject to change without notice.

Oracle9i Application Server: Options for Running Active Server Pages. An Oracle White Paper July 2001

Configuration Worksheets for Oracle WebCenter Ensemble 10.3

Railo Installation on CentOS Linux 6 Best Practices

Enterprise Knowledge Platform

GlobalSign Solutions

Welcome to Apache the number one Web server in

ContaCam in WINE (Ubuntu) Howto:

SOA Software API Gateway Appliance 7.1.x Administration Guide

Web Service Reference

Dynamic DNS How-To Guide

13.1 Backup virtual machines running on VMware ESXi / ESX Server

Red Hat Linux Guide to Installing Root Certificates, Generating CSR and Installing SSL Certificate

End User Guide The guide for /ftp account owner

Authentication Methods

CC ICT-SUD. Setting up and integrate Apache, MySQL and PHP on a Linux system

WEB2CS INSTALLATION GUIDE

IBM TRIRIGA Application Platform Version 3 Release 4.1. Single Sign-On Setup User Guide

idatafax Troubleshooting

DocuShare Installation Guide

Elluminate Live! Access Guide. Page 1 of 7

Talk-101 User Guides Mailgate Administration Guide

NAS 109 Using NAS with Linux

Exchange 2013 mailbox setup guide

SSL Enforcer Documentation

How to: Install an SSL certificate

Rebasoft Auditor Quick Start Guide

Install an SSL Certificate onto SilverStream. Sender Recipient Attached FIles Pages Date. Development Internal/External None 5 6/16/08

nitrobit update server

Transcription:

Apache & Virtual Hosts & mod_rewrite Jonathan Brewer Network Startup Resource Center jon@nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International license (http://creativecommons.org/licenses/by-nc/4.0/)

Very good overview here: What is Apache? http://en.wikipedia.org/wiki/apache_web_server The Apache web site is also an excellent source of information: http://www.apache.org/

Initially released in 1995 Quick Facts Used on around 250 million web sites Approximately 65% of all sites worldwide use Apache 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. Originally designed by Robert McCool who was involved with the original web server, NCSA's HTTPd. Named Apache either because it involved many patches to the original NCSA server, or after the American Indian Apache tribe.

There are two types: Name-based IP-based What is a Virtual Host? 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. For some ssl virtual hosting tricks see: http://wiki.apache.org/httpd/namebasedsslvhosts

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) works even if DNS has failed. However, requires an IP address for each site. This may not be possible and requires more effort to implement. IP addresses are running out.

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

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 http://www.example.com/ The site resides in /usr/local/www/share/default/, but you want the files in /usr/local/www/books/ to be available at http://www.example.com/books/ How would you do this?

In the file httpd.conf... Aliases continued Alias /books /usr/local/www/books You must set Directory permissions as well. <Directory /usr/local/www/books > Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> 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 you move a large number of pages In order to use mod_rewrite the rewrite module must be part of your Apache install and it must be loaded: /etc/apache2/mods-enabled/rewrite.load # a2enmod rewrite # server apache2 restart

mod_rewrite continued Here is some sample code where mod_rewrite is actually used (from sites/000-default): # turn on the use of the mod_rewrite module RewriteEngine on # trac logins must be secure RewriteCond %{SERVER_PORT}!443 RewriteCond %{REQUEST_URI} ^/trac RewriteRule ^(.*)$ https://nsrc.org$1 [R=301] Forces all users viewing wiki pages to do so using https (SSL), including logins. Very commonly used. [R=301] Apache Redirect Response

htaccess 1. Use mod_rewrite to force https for any directory 2. Use htaccess to require a password. Create a file.htaccess in the directory you wish to protect. In that file you might have something like this: AuthName My Personal Photos" AuthType Basic AuthUserFile /home/user/public_html/photos/.htpasswd require user sebastian 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?