SlideShare a Scribd company logo
Chapter 19Chapter 19
Web ServerWeb Server
Web ServiceWeb Service
Server
(httpd)
Resources
(HTML,images...)
Client
(Browser) HTTP
Apache Web ServerApache Web Server
●
Service name (Redhat/CentOS):Service name (Redhat/CentOS):
– apacheapache
●
Daemon name (Redhat/CentOS):Daemon name (Redhat/CentOS):
– httpdhttpd
●
Daemon name (Ubuntu):Daemon name (Ubuntu):
– apache2apache2
Controlling ApacheControlling Apache
●
service <daemon_name> <command>service <daemon_name> <command>
– Commands:Commands:
●
start start : start daemon: start daemon
●
stop stop : stop daemon: stop daemon
●
restart restart : restart daemon: restart daemon
●
status status : status report: status report
●
configtest configtest : test configuration: test configuration
Apache Configuration FileApache Configuration File
●
apache[2].confapache[2].conf
– Location may vary from distributionsLocation may vary from distributions
– More configuration files may be included by usingMore configuration files may be included by using
IIncludenclude statementstatement
– HTML like syntax with <TAG> </TAG> directivesHTML like syntax with <TAG> </TAG> directives
Common DirectivesCommon Directives
●
User / GroupUser / Group
– UID/GID of processes to access file systemUID/GID of processes to access file system
●
ListenListen
– Listening portListening port
●
ServerNameServerName
– FQDN to responseFQDN to response
●
DocumentRootDocumentRoot
– Top directory to access for resourcesTop directory to access for resources
●
ServerAdminServerAdmin
– Administrator's emailAdministrator's email
User Home DirectoryUser Home Directory
●
URL:URL: http://web.server/~userhttp://web.server/~user
<IfModule mod_userdir.c><IfModule mod_userdir.c>
        #UserDir disable#UserDir disable
        UserDir public_htmlUserDir public_html
</IfModule></IfModule>
●
Place document underPlace document under ~user/public_html~user/public_html
●
Must be accessible by apache daemonMust be accessible by apache daemon
Access ControlAccess Control
<Directory "/var/www/html/secret"><Directory "/var/www/html/secret">
        Options Indexes FollowSymLinksOptions Indexes FollowSymLinks
        AllowOverride AuthConfigAllowOverride AuthConfig
        Order deny,allowOrder deny,allow
        Deny from allDeny from all
        Allow from 192.168.100.0/24Allow from 192.168.100.0/24
</Directory></Directory>
Access ControlAccess Control
●
Order <X> <Y>Order <X> <Y>
– Only in X then XOnly in X then X
– Only in Y then YOnly in Y then Y
– Both in X & Y then YBoth in X & Y then Y
●
Allow|Deny <CLIENT>Allow|Deny <CLIENT>
– all all : all hosts: all hosts
– IP.IP.IP.IP IP.IP.IP.IP : specific IP: specific IP
– IP.IP. IP.IP. : partial IP: partial IP
– NET/MASK NET/MASK : a network: a network
Access AuthenticationAccess Authentication
●
vi /var/www/html/secret/.htaccessvi /var/www/html/secret/.htaccess
        AuthName "secret"AuthName "secret"
        AuthType BasicAuthType Basic
        AuthUserFile "/var/www/.htpasswd.secret"AuthUserFile "/var/www/.htpasswd.secret"
        require valid­userrequire valid­user
●
htpasswd htpasswd ­c­c /var/www/html/secret/.htaccess user /var/www/html/secret/.htaccess user
●
chmod 640 /var/www/html/secret/.htaccesschmod 640 /var/www/html/secret/.htaccess
●
chgrp apache /var/www/html/secret/.htaccesschgrp apache /var/www/html/secret/.htaccess
* Note: the* Note: the ­c­c options ofoptions of htpasswdhtpasswd is supplied at firstis supplied at first
time running the program only.time running the program only.
Virtual HostVirtual Host
Virtual HostVirtual Host
NameVirtualHost *:80NameVirtualHost *:80
<VirtualHost *:80><VirtualHost *:80>
        ServerAdmin root@my.comServerAdmin root@my.com
        DocumentRoot "/var/www/html"DocumentRoot "/var/www/html"
        ServerName server1.my.comServerName server1.my.com
</VirtualHost></VirtualHost>
<VirtualHost *:80><VirtualHost *:80>
        ServerAdmin webmaster@www.my.comServerAdmin webmaster@www.my.com
        DocumentRoot /var/www/vhost/www.my.comDocumentRoot /var/www/vhost/www.my.com
        ServerName www.my.comServerName www.my.com
</VirtualHost></VirtualHost>
<Directory "/var/www/vhost/www.my.com"><Directory "/var/www/vhost/www.my.com">
        Options Indexes FollowSymLinksOptions Indexes FollowSymLinks
        AllowOverride AuthConfigAllowOverride AuthConfig
        Order allow,denyOrder allow,deny
        Allow from allAllow from all
</Directory></Directory>
Enabling HTTPSEnabling HTTPS
●
Listening on 443/TCPListening on 443/TCP
●
UseUse https://https:// instead ofinstead of http://http:// in URLin URL
●
All HTTP traffics are encryptedAll HTTP traffics are encrypted
●
Need a CA signed certificate while using in theNeed a CA signed certificate while using in the
public networkpublic network
●
Self-signed certificate can be used in privateSelf-signed certificate can be used in private
networks or for test purposenetworks or for test purpose
Enabling HTTPSEnabling HTTPS
●
Create a self-singed certificate:Create a self-singed certificate:
– openssl gen rsa ­des3 ­out tmp.key 1024openssl gen rsa ­des3 ­out tmp.key 1024
– openssl rsa ­in tmp.key ­out server.keyopenssl rsa ­in tmp.key ­out server.key
– chmod 600 server.keychmod 600 server.key
– openssl req ­new ­key server.key ­out openssl req ­new ­key server.key ­out 
server.csrserver.csr
– openssl x509 ­req ­days 365 ­in server.csr openssl x509 ­req ­days 365 ­in server.csr 
­signkey server.key ­out server.crt­signkey server.key ­out server.crt
– mv server.crt /etc/pki/tls/certs/mv server.crt /etc/pki/tls/certs/
– mv server.key /etc/pki/tls/private/mv server.key /etc/pki/tls/private/
* Note: the* Note: the certs/certs/ andand private/private/ directoriesdirectories
may vary from systemsmay vary from systems
Enabling HTTPSEnabling HTTPS
●
Configure apache:Configure apache:
– SSLCertificateFile /etc/pki/tls/certs/server.crtSSLCertificateFile /etc/pki/tls/certs/server.crt
– SSLCertificateKeyFileSSLCertificateKeyFile
/etc/pki/tls/private/server.key/etc/pki/tls/private/server.key
* Note: the path of SSL configuration file may vary* Note: the path of SSL configuration file may vary
from systems.from systems.
●
Restart apache daemonRestart apache daemon

More Related Content

PDF
Importance of linux system fundamental in technical documentation reading
PDF
Linux fundamental - Chap 09 pkg
PDF
Linux fundamental - Chap 08 proc
PDF
Linux fundamental - Chap 01 io
PDF
Haproxy - zastosowania
PDF
Linux fundamental - Chap 11 boot
PDF
A little systemtap
Importance of linux system fundamental in technical documentation reading
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 01 io
Haproxy - zastosowania
Linux fundamental - Chap 11 boot
A little systemtap

What's hot (18)

PDF
Performance comparison of Distributed File Systems on 1Gbit networks
ODP
LSA2 - 01 Virtualization with KVM
ODP
LSA2 - 02 Control Groups
PDF
Introduction of unit test on android kernel
PDF
nouka inventry manager
PDF
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
PDF
New Ways to Find Latency in Linux Using Tracing
PDF
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
PDF
PPTX
Linux kernel debugging
PDF
Red Hat Certified Engineer (RHCE) EX294 Exam Questions
PDF
Go replicator
PDF
Linux: LVM
ODP
LSA2 - 02 Namespaces
PDF
PFIセミナー資料 H27.10.22
PDF
1 m+ qps on mysql galera cluster
PDF
Backing up thousands of containers
DOCX
Using cgroups in docker container
Performance comparison of Distributed File Systems on 1Gbit networks
LSA2 - 01 Virtualization with KVM
LSA2 - 02 Control Groups
Introduction of unit test on android kernel
nouka inventry manager
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
New Ways to Find Latency in Linux Using Tracing
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Linux kernel debugging
Red Hat Certified Engineer (RHCE) EX294 Exam Questions
Go replicator
Linux: LVM
LSA2 - 02 Namespaces
PFIセミナー資料 H27.10.22
1 m+ qps on mysql galera cluster
Backing up thousands of containers
Using cgroups in docker container
Ad

Viewers also liked (20)

PDF
Apache HTTPd Server 2.2 Presentation
PDF
Apache Web Server Administration
PDF
httpd — Apache Web Server
PDF
Apache and PHP: Why httpd.conf is your new BFF!
PPTX
Apache
PDF
Learn how to develop for Android, beyond the Hello World android app - Cape T...
PDF
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
PDF
Linux pipe & redirection
PDF
Chap 18 net
PPT
Linux Commands
ODP
Ras pioverview
PDF
Linux fundamental - Chap 16 System Rescue
PPT
Unix tutorial-08
PDF
Chap 17 advfs
PDF
Linux network monitoring hands-on pratice
PDF
Linux fundamentals
PPTX
Basics of-linux
PPT
Power point (asking permission)
PPTX
Unix - Filters/Editors
PDF
Linux fundamental - Chap 13 account management
Apache HTTPd Server 2.2 Presentation
Apache Web Server Administration
httpd — Apache Web Server
Apache and PHP: Why httpd.conf is your new BFF!
Apache
Learn how to develop for Android, beyond the Hello World android app - Cape T...
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
Linux pipe & redirection
Chap 18 net
Linux Commands
Ras pioverview
Linux fundamental - Chap 16 System Rescue
Unix tutorial-08
Chap 17 advfs
Linux network monitoring hands-on pratice
Linux fundamentals
Basics of-linux
Power point (asking permission)
Unix - Filters/Editors
Linux fundamental - Chap 13 account management
Ad

Similar to Chap 19 web (20)

PDF
Meeting 14. web server ii
PDF
Lesson 9. The Apache Web Server
PPT
Apache Street Smarts Presentation (SANS 99)
PDF
Running the Apache Web Server
PPT
Apache
PPT
Ch 22: Web Hosting and Internet Servers
PDF
Apache Server Tutorial
PDF
Apache HTTPD 2.4 - GWO2016
PDF
Apache httpd v2.4
PDF
Configuration of Apache Web Server On CentOS 8
PPTX
Apache server configuration & optimization
PPT
Apache1.ppt
PPT
Durkee apache 2009_v7
ODP
Apache doc
PDF
PowerPoint Presentation
PPTX
Web server installation_configuration_apache
KEY
Apache Cookbook - TekX Chicago 2010
PPT
Apache1.ppt
PPT
Linux apache installation
PDF
Apache course contents
Meeting 14. web server ii
Lesson 9. The Apache Web Server
Apache Street Smarts Presentation (SANS 99)
Running the Apache Web Server
Apache
Ch 22: Web Hosting and Internet Servers
Apache Server Tutorial
Apache HTTPD 2.4 - GWO2016
Apache httpd v2.4
Configuration of Apache Web Server On CentOS 8
Apache server configuration & optimization
Apache1.ppt
Durkee apache 2009_v7
Apache doc
PowerPoint Presentation
Web server installation_configuration_apache
Apache Cookbook - TekX Chicago 2010
Apache1.ppt
Linux apache installation
Apache course contents

More from Kenny (netman) (20)

TXT
rpi_audio configuration steps
PDF
Rpi audio
PDF
Ha opensuse
PDF
About the Course
PDF
Linux fundamental - Chap 15 Job Scheduling
PDF
Linux fundamental - Chap 14 shell script
PDF
Linux fundamental - Chap 12 Hardware Management
PDF
Linux fundamental - Chap 10 fs
PDF
Linux fundamental - Chap 07 vi
PDF
Linux fundamental - Chap 06 regx
PDF
Linux fundamental - Chap 05 filter
PDF
Linux fundamental - Chap 04 archive
PDF
Linux fundamental - Chap 03 file
PDF
Linux fundamental - Chap 02 perm
PDF
Linux fundamental - Chap 00 shell
PDF
Linux system security
PDF
Linux Network Monitoring
PDF
加密應用(GPG)
PDF
金鑰管理 (PKI)
PDF
Linux firewall
rpi_audio configuration steps
Rpi audio
Ha opensuse
About the Course
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 04 archive
Linux fundamental - Chap 03 file
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 00 shell
Linux system security
Linux Network Monitoring
加密應用(GPG)
金鑰管理 (PKI)
Linux firewall

Recently uploaded (20)

PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Institutional Correction lecture only . . .
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Pre independence Education in Inndia.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Insiders guide to clinical Medicine.pdf
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Microbial disease of the cardiovascular and lymphatic systems
Basic Mud Logging Guide for educational purpose
Institutional Correction lecture only . . .
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Pre independence Education in Inndia.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
PPH.pptx obstetrics and gynecology in nursing
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Week 4 Term 3 Study Techniques revisited.pptx
Cell Structure & Organelles in detailed.
Insiders guide to clinical Medicine.pdf
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Final Presentation General Medicine 03-08-2024.pptx

Chap 19 web