CO 246 - Web Server Administration and Security. By: Szymon Machajewski



Similar documents
Setup a Virtual Host/Website

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

Business Ethics. By: Aims Community College - Oil & Gas Dept.

Apache and Virtual Hosts Exercises

Lab 3.4.2: Managing a Web Server

Virtual Host Continue

Apache HTTP Server. Implementation Guide. (Version 5.7) Copyright 2013 Deepnet Security Limited

Virtual Host (Web Server)

User s guide. APACHE SSL Linux. Using non-qualified certificates with APACHE SSL Linux. version 1.3 UNIZETO TECHNOLOGIES S.A.

LAMP Quickstart for Red Hat Enterprise Linux 4

Installing Rails 2.3 Under CentOS/RHEL 5 and Apache 2.2

Integrating Apache Web Server with Tomcat Application Server

Apache 2.2 on QNX Neutrino 6.4.x OS Step-by-step installation manual

Cloud Homework instructions for AWS default instance (Red Hat based)

Configuring Ubuntu Server as a Firewall and Reverse Proxy for OWA 2007 Configuration Guide

Exercises: FreeBSD: Apache and SSL: pre SANOG VI Workshop

How to: Install an SSL certificate

Installing OptiRain Open on Macintosh OS X 10.6 (Snow Leopard)

SIMIAN systems. Setting up a Sitellite development environment on Mac OS X. Sitellite Content Management System

Web Server using Apache. Heng Sovannarith

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

INSTALLING KAAZING WEBSOCKET GATEWAY - HTML5 EDITION ON AN AMAZON EC2 CLOUD SERVER

Moving Drupal to the Cloud: A step-by-step guide and reference document for hosting a Drupal web site on Amazon Web Services

Music Fundamentals 5: Triads, Chords, Introduction to Roman Numerals. Collection Editor: Terry B. Ewell

How To Set Up A Virtual Host In Apa On A Linux Box On A Windows Xp Or Ipa On An Ubuntu Box On An Ipa (Windows) Or Ipo (Windows Xp) On A Ubora Box On Your Ubora

Creating X.509 Certificates With OpenSSL

HOW TO SETUP AN APACHE WEB SERVER AND INTEGRATE COLDFUSION

How to setup HTTP & HTTPS Load balancer for Mediator

Expresso Quick Install

Using a login script for deployment of Kaspersky Network Agent to Mac OS X clients

CPE111 COMPUTER EXPLORATION

Installation of the Shibboleth-Apache Authorisation Module. 2. Obtain and compile the Apache server software

Configuring MailArchiva with Insight Server

DEPLOYMENT GUIDE Version 1.1. Deploying F5 with Oracle Application Server 10g

Installing an SSL certificate on the InfoVaultz Cloud Appliance

Step-by-Step guide to setup an IBM WebSphere Portal and IBM Web Content Manager V8.5 Cluster From Zero to Hero (Part 2.)

Apache Configuration

Deploying the BIG-IP System v10 with Oracle Application Server 10g R2

HOW TO BUILD A VMWARE APPLIANCE: A CASE STUDY

Security Correlation Server Quick Installation Guide

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

Contents Set up Cassandra Cluster using Datastax Community Edition on Amazon EC2 Installing OpsCenter on Amazon AMI References Contact

Single Node Hadoop Cluster Setup

Spam Marshall SpamWall Step-by-Step Installation Guide for Exchange 5.5

Installation Guide for FTMS and Node Manager 1.6.0

Cacti The ULTIMATE Management Solution

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

About This Document 3. Integration Overview 4. Prerequisites and Requirements 6

AlienVault Unified Security Management (USM) 4.x-5.x. Deploying HIDS Agents to Linux Hosts

Install Apache on windows 8 Create your own server

Hadoop Basics with InfoSphere BigInsights

GlobalSign Solutions

1. Configuring Apache2 Load Balancer with failover mechanism

GroundWork Monitor Open Source Installation Guide

Sharp Remote Device Manager (SRDM) Server Software Setup Guide

Hadoop Basics with InfoSphere BigInsights

WebBridge LR Integration Guide

IBM WebSphere Application Server V8.5 lab Basic Liberty profile administration using the job manager

tpischeduler tpischeduler TotalFBO tpischeduler TotalFBO Initial Installation tpischeduler TotalFBO tpischeduler

Partek Flow Installation Guide

Installing SQL-Ledger on Windows

Installation Instructions Release Version 15.0 January 30 th, 2011

Installing Apache Software

WES 9.2 DRIVE CONFIGURATION WORKSHEET

IBM Software Hadoop Fundamentals

Integration with Active Directory

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

MassTransit 6.0 Enterprise Web Configuration for Macintosh OS 10.5 Server

Extending Remote Desktop for Large Installations. Distributed Package Installs

Cassandra Installation over Ubuntu 1. Installing VMware player:

Install and configure Apache, MySQL, PHP on OSX 10.8 Mountain Lion

Best Practices in Hardening Apache Services under Linux

CN=Monitor Installation and Configuration v2.0

WEB2CS INSTALLATION GUIDE

Apache 2.0 Installation Guide

Contents: 1. Preparation/download files 2. Apache HTTPD Web Server MySQL PHP PHPMyAdmin Ruby On Rails 1.8.

DS License Server V6R2013x

Intrusion Detection and Prevention: Network and IDS Configuration and Monitoring using Snort

Installing, Uninstalling, and Upgrading Service Monitor

Quick Installation Guide. CereusReporting - Express Edition

Setting Up SSL on IIS6 for MEGA Advisor

Redmine Installation on Debian. v1.1

Backup of ESXi Virtual Machines using Affa

Git - Working with Remote Repositories

Configuring Apache and IIS for High Availability Web Server Clustering

Web Same-Origin-Policy Exploration Lab

APACHE HTTP SERVER 2.2.8

DataSuite Installation and Activation Guide

Exercises: FreeBSD: Apache and SSL: SANOG VI IP Services Workshop

Installing Virtual Coordinator (VC) in Linux Systems that use RPM (Red Hat, Fedora, CentOS) Document # 15807A1-103 Date: Aug 06, 2012

TECHNICAL NOTE SETTING UP A STRM UPDATE SERVER. Configuring your Update Server

dotdefender v5.12 for Apache Installation Guide Applicure Web Application Firewall Applicure Technologies Ltd. 1 of 11 support@applicure.

Security Workshop. Apache + SSL exercises in Ubuntu. 1 Install apache2 and enable SSL 2. 2 Generate a Local Certificate 2

STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

Weston Public Schools Virtual Desktop Access Instructions

DS License Server. Installation and Configuration Guide. 3DEXPERIENCE R2014x

SOLR INSTALLATION & CONFIGURATION GUIDE FOR USE IN THE NTER SYSTEM

Transcription:

CO 246 - Web Server Administration and Security By: Szymon Machajewski

CO 246 - Web Server Administration and Security By: Szymon Machajewski Online: < http://cnx.org/content/col11452/1.1/ > C O N N E X I O N S Rice University, Houston, Texas

This selection and arrangement of content as a collection is copyrighted by Szymon Machajewski. It is licensed under the Creative Commons Attribution 3.0 license (http://creativecommons.org/licenses/by/3.0/). Collection structure revised: November 1, 2012 PDF generated: November 1, 2012 For copyright and attribution information for the modules contained in this collection, see p. 10.

Table of Contents 1 Apache httpd Web Server - installation from source code.................................... 1 2 Apache httpd Web Server - basic conguration................................................ 3 3 Apache httpd Web Server - logs lab............................................................ 7 Index..................................................................................................9 Attributions......................................................................................... 10

iv

Chapter 1 Apache httpd Web Server - installation from source code1 Start the lab by booting your Knoppix system. You can simply put it in a CDROM and restart the computer or you can use a VMware virtual machine. Once you see the Knoppix desktop simply click on the Console icon at the bottom of the screen. You can stay logged in as the knoppix user. Open the Terminal window for the lab and type in commands into the Terminal. Exercise 1.1: Step 1 (Solution on p. 2.) 1. Download Apache sources. You can download the source code directly from the Apache Foundation (http://httpd.apache.org/), or you can use the local GRCC repository. In the classroom the local download will be much faster. Exercise 1.2: Step 2 (Solution on p. 2.) 2. Decompress and extract the source les. Exercise 1.3: Step 3 (Solution on p. 2.) 3. Change directory to the source directory. Exercise 1.4: Step 4 (Solution on p. 2.) 4. Clean source tree. If you are compiling for the rst time you can skip this step. Executing this step will not change any conguration. Exercise 1.5: Step 5 (Solution on p. 2.) 5. Congure the sources. Exercise 1.6: Step 6 (Solution on p. 2.) 6. Compile source code Exercise 1.7: Step 7 (Solution on p. 2.) 7. Install source code Exercise 1.8: Step 8 (Solution on p. 2.) 8. Start Apache server Exercise 1.9: Step 9 (Solution on p. 2.) 9. Test to check if Apache is running Exercise 1.10: Step 10 (Solution on p. 2.) 10. Test with terminal commands Exercise 1.11: Step 11 (Solution on p. 2.) 11. To start the entire process over run the following command to delete your apache system. ATTENTION! The rm -rf command will uninstall or delete the Apache Web Server. 1 This content is available online at <http://cnx.org/content/m45031/1.2/>. 1

2 CHAPTER 1. Solutions to Exercises in Chapter 1 Solution to Exercise 1.1 (p. 1) wget http://raider.grcc.edu/ smachaje/co246/httpd-2.0.59.tar.gz Solution to Exercise 1.2 (p. 1) tar -xzvf httpd-2.0.59.tar.gz Solution to Exercise 1.3 (p. 1) cd httpd-2.0.59 Solution to Exercise 1.4 (p. 1) make clean Solution to Exercise 1.5 (p. 1)./congure prex=/home/knoppix/apache with-port=8080 Solution to Exercise 1.6 (p. 1) make Solution to Exercise 1.7 (p. 1) make install Solution to Exercise 1.8 (p. 1) cd /home/knoppix/apache bin/apachectl start Solution to Exercise 1.9 (p. 1) Open the browser and navigate to http://localhost:8080/ Solution to Exercise 1.10 (p. 1) netstat -ln grep 8080 ps -ef grep httpd Solution to Exercise 1.11 (p. 1) killall httpd rm -rf /home/knoppix/apache APACHE HTTPD WEB SERVER - INSTALLATION FROM SOURCE CODE

Chapter 2 Apache httpd Web Server - basic conguration 1 Exercise 2.1: Conguration le (Solution on p. 6.) Open and review the main conguration le for our Apache installation. note: You can use any text editor. The solutions will use leafpad from Knoppix livecd. Other editors on the Knoppix CD include: vi, xedit, nano, pico. Exercise 2.2 (Solution on p. 6.) First let's x the error message which comes up every time we start apache. The message says: httpd: Could not determine the server's fully qualied domain name, using 127.0.0.1 for Server- Name Exercise 2.3 (Solution on p. 6.) Find the following directives and change their values in the conguration le. For new conguration to take eect you have to save the conguration le and restart apache. Above at the end of step 1 you will nd the commands to restart apache. Find the following directives and change their values: A) Change ServerAdmin to your email address. Before change: ServerAdmin you@example.com Change to: ServerAdmin myemail@host.com B) Add index.php to the default pages. Before change: DirectoryIndex index.html index.html.var Change to: DirectoryIndex index.html index.html.var index.php C) Change the detail of logging. Before change: LogLevel warn 1 This content is available online at <http://cnx.org/content/m45045/1.1/>. 3

4 CHAPTER 2. APACHE HTTPD WEB SERVER - BASIC CONFIGURATION Change to: LogLevel error D) Change Server Signature: ServerSignature Email E) Change the server HTTP Header information: ServerTokens Prod F) Change the user and group which Apache runs as: User knoppix Group knoppix Exercise 2.4: Virtual Hosts (Solution on p. 6.) 1. Setup site host names Edit /etc/hosts. You need to edit the lines as the root user. In the terminal type in: su leafpad /etc/hosts add the following lines: 127.0.0.1 www.co246.com 127.0.0.1 go.co246.com 127.0.0.1 student.co246.com Exit the shell as root so you are logged in as Knoppix. Test the host names by visiting the urls in a browser. Remember to start the Apache server on port 8080. 2. Congure Apache to recognize Virtual Hosts Edit httpd.conf and add the following sections: # Use name-based virtual hosting. # NameVirtualHost *:8080 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The rst VirtualHost section is used for requests without a known

5 # server name. # <VirtualHost *:8080> ServerAdmin student@grcc.edu DocumentRoot /home/knoppix/go_co246_htdocs/ ServerName go.co246.com ErrorLog logs/go_co246_error_log CustomLog logs/go_co246_access_log common </VirtualHost> <VirtualHost *:8080> ServerAdmin student@grcc.edu DocumentRoot /home/knoppix/student_co246_htdocs/ ServerName student.co246.com ErrorLog logs/student_co246_error_log CustomLog logs/student_co246_access_log common <VirtualHost> <VirtualHost *:8080> ServerAdmin student@grcc.edu DocumentRoot /home/knoppix/www_co246_htdocs/ ServerName www.co246.com ErrorLog logs/www_co246_error_log CustomLog logs/www_co246_access_log common <VirtualHost> 3. Create each DocumentRoot directory with a sample index.html page. For example create: mkdir /home/knoppix/www_co246_htdocs cd /home/knoppix/www_co246_htdocs echo ``This is www_co246 site'' > index.html mkdir /home/knoppix/go_co246_htdocs cd /home/knoppix/go_co246_htdocs echo ``This is go_co246 site'' > index.html mkdir /home/knoppix/student_co246_htdocs cd /home/knoppix/student_co246_htdocs echo ``This is student_co246 site'' > index.html

6 CHAPTER 2. APACHE HTTPD WEB SERVER - BASIC CONFIGURATION Solutions to Exercises in Chapter 2 Solution to Exercise 2.1 (p. 3) leafpad /home/knoppix/apache/conf/httpd.conf Solution to Exercise 2.2 (p. 3) To x it edit the httpd.conf le ( leafpad /home/knoppix/apache/conf/httpd.conf ) and change the Server- Name directive to be: ServerName localhost:8080 The directive before the change: #ServerName www.example.com:80 The directive after change: ServerName localhost:8080 Save the le and restart apache: cd /home/knoppix/apache bin/apachectl stop bin/apachectl start or /home/knoppix/apache/bin/apachectl restart Now you shouldn't see an error message when Apache starts. Solution to Exercise 2.3 (p. 3) Test the excercise by visiting the following urls on the your server: http://localhost:8080/manual/ http://localhost:8080/icons/ (note at the bottom of the icon les the localhost link. It should have your email address as the destination url) http://localhost:8080/cgi-bin/test-cgi (if you get an error here that's ne. to x the error run: chmod 777 /home/knoppix/apache/cgi-bin/* view the HTTP HEADERS of your server: wget --spider -S http://localhost:8080/ Solution to Exercise 2.4 (p. 4) Open a browser and navigate to http://www.co246.com, http://go.co246.com, http://student.co246.com

Chapter 3 Apache httpd Web Server - logs lab 1 Exercise 3.1 (Solution on p. 8.) 1. Enable extended server status in httpd.conf le. You can nd instructions in the Apache manual http://httpd.apache.org/docs/2.0/mod/mod_status.html 2. Generate Apache activity: apache/bin/ab -n 200 -c 1 http://localhost:8080/ apache/bin/ab -n 200000 -c 1000 http://localhost:8080/ 3. View the server status at: http://localhost:8080/server-status 4. Monitor log les at apache/logs/ tail -f apache/logs/access_log 5. Generate error logs: apache/bin/ab -n 200 -c 1 http://localhost:8080/`date +%s` for ((i=1;i<5;i+=1)); do apache/bin/ab -n 2 -c 1 http://localhost:8080/`date +%s`; sleep 2; done; 1 This content is available online at <http://cnx.org/content/m45046/1.1/>. 7

8 CHAPTER 3. APACHE HTTPD WEB SERVER - LOGS LAB Solutions to Exercises in Chapter 3 Solution to Exercise 3.1 (p. 7) Monitor log les at apache/logs/ cat /home/knoppix/apache/logs/access_log

INDEX 9 Index of Keywords and Terms Keywords are listed by the section with that keyword (page numbers are in parentheses). Keywords do not necessarily appear in the text of the page. They are merely associated with that section. Ex. apples, Ÿ 1.1 (1) Terms are referenced by the page they appear on. Ex. apples, 1 A apache, Ÿ 1(1), Ÿ 2(3), Ÿ 3(7) C compiling, Ÿ 1(1) computer science, Ÿ 1(1) conguration, Ÿ 2(3) H httpd, Ÿ 1(1), Ÿ 2(3), Ÿ 3(7) httpd.conf, Ÿ 2(3) L log les, Ÿ 3(7) logs, Ÿ 3(7) S security, Ÿ 1(1) source code, Ÿ 1(1) T technology, Ÿ 1(1) W web server, Ÿ 1(1)

10 ATTRIBUTIONS Attributions Collection: CO 246 - Web Server Administration and Security Edited by: Szymon Machajewski URL: http://cnx.org/content/col11452/1.1/ License: http://creativecommons.org/licenses/by/3.0/ Module: "Apache httpd Web Server - installation from source code" By: Szymon Machajewski URL: http://cnx.org/content/m45031/1.2/ Pages: 1-2 Copyright: Szymon Machajewski License: http://creativecommons.org/licenses/by/3.0/ Module: "Apache httpd Web Server - basic conguration" By: Szymon Machajewski URL: http://cnx.org/content/m45045/1.1/ Pages: 3-6 Copyright: Szymon Machajewski License: http://creativecommons.org/licenses/by/3.0/ Module: "Apache httpd Web Server - logs lab" By: Szymon Machajewski URL: http://cnx.org/content/m45046/1.1/ Pages: 7-8 Copyright: Szymon Machajewski License: http://creativecommons.org/licenses/by/3.0/

About Connexions Since 1999, Connexions has been pioneering a global system where anyone can create course materials and make them fully accessible and easily reusable free of charge. We are a Web-based authoring, teaching and learning environment open to anyone interested in education, including students, teachers, professors and lifelong learners. We connect ideas and facilitate educational communities. Connexions's modular, interactive courses are in use worldwide by universities, community colleges, K-12 schools, distance learners, and lifelong learners. Connexions materials are in many languages, including English, Spanish, Chinese, Japanese, Italian, Vietnamese, French, Portuguese, and Thai. Connexions is part of an exciting new information distribution system that allows for Print on Demand Books. Connexions has partnered with innovative on-demand publisher QOOP to accelerate the delivery of printed course materials and textbooks into classrooms worldwide at lower prices than traditional academic publishers.