SlideShare a Scribd company logo
1 of 16
Gaurav Mishra
<gmishx@gmail.com>
Linux - 5
Apache Configuration file,
Cron jobs,
Proxy server
2/27/2018
Unrestricted
Gaurav Mishra <gmishx@gmail.com>
Apache http server
• One of the most commonly used open source sever
• Can be easily tuned
• Works in harmony with PHP
• Provides various security measures
• Installs as httpd in many Linux distros
• Packages as apache2 in Debian based distributions
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Apache directory structure
• The apache foundation have their hierarchical structure for the respective
configuration files.
• The root is located at: /etc/apache2/
• The main configuration file is located at ./apache2.conf
• The modules currently installed are located at: ./mods-available/
• The modules currently in use are located at: ./mods-enabled/
• The websites/virtual host available for current install are located at: ./sites-available/
• The websites/virtual host being used for current run are located at: ./sites-enabled/
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Apache configuration file
• The global configuration file is stored at /etc/apache2/apache2.conf
• Can be overridden for each directory using .htaccess
• The file contains directives, mostly distributed in directive blocks
• Commonly used directive blocks:
▫ directory
 Contains directives defined for a particular directory
▫ VirtualHost
 Directives defined for a virtual host
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
List of common directives
• Alias
• Allow
• AllowOverride
• AuthBasicAuthoritative
• AuthType
• Deny
• <Directory>
• DocumentRoot
• <Else>
• ErrorLog
• ErrorLogFormat
• <If>
• <IfModule>
• Include
• KeepAlive
• Listen
• LoadModule
• Redirect
• RedirectMatch
• ServerAdmin
• ServerAlias
• ServerLimit
• ServerName
• SSLCertificateFile
• SSLCertificateKeyFile
• SSLEngine
• <VirtualHost>
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Setting up directory directive
Alias “/holidaypics” “/var/www/html/newpics”
<Directory /var/www/html/newpics>
AuthType Basic
AuthName Newpics
AuthUserFile /web/users
AuthGroupFile /web/groups
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
<Files dinner.jpg>
order deny,allow
deny from all
allow from 127.0.0.1
</Files>
</Directory>
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Setting up VirtualHost
• Virtual hosting allows the Apache web server to host multiple websites as part of its
own.
ServerName server.example.com
ServerAlias server server2.example.com server2
ServerAlias *.example.com
<VirtualHost server.example.com:80>
Alias /files /home/user/Documents/files
<Directory "/home/user/Documents/files">
AllowOverride None
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Setting up SSL support
<IfModule mod_ssl.c>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/certi.cer
SSLCertificateKeyFile /etc/ssl/keys/certi.key
</VirtualHost>
</IfModule>
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Apache tools
• To enable a website configuration from /etc/apache2/sites-available/mysite.conf
▫ a2ensite mysite
• To disable a website configuration from /etc/apache2/sites-available/mysite.conf
▫ a2dissite mysite
• To enable a module from /etc/apache2/mods-available/mymod.conf
▫ a2enmod mymod
• To disable a module from /etc/apache2/mods-available/mymod.conf
▫ a2dismod mymod
• Check the syntax of apache2.conf
▫ apachectl configtest
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Cron jobs
• Cron jobs are set of actions which must be executed at a certain time on a given day.
• Cron daemon keeps checking these cron jobs and execute them whenever required.
• Each user can have their own cron jobs.
• The job set by a user run with their privileges.
• The cron jobs are stored in crontab files.
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Crontab format
• The format of a crontab field follows:
▫ minute hour day-month month day(s)-week task
• A crontab entry has six fields:
▫ The first five are used to specify the time for an action
 The first field specifies the minute (0–59)
 The second field specifies the houst (0-23)
 The third field specifies the day of the month (1–31)
 The fourth field specifies the month of the year (1–12, or month prefixes like Jan and Sep)
 And the fifth field specifies the day of the week (0–6, or day prefixes like Wed and Fri),
starting with 0 as Sunday.
▫ The last field is the action itself.
• Each field can be defined as range or using * to match all
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Crontab examples
• Take backup at 2:00 AM from Mon-Friday of every month
▫ 0 2 * * 1-5 tar cf /home/backp /home/projects
• Take backup at 2:00 AM on Sun, Wed, Fri of every month
▫ 0 2 * * 0,3,5 tar cf /home/backp /home/projects
• Take backup every other day at 2:00 AM on any day
▫ 0 2 */2 * * tar cf /home/backp /home/projects
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Adding a cron job
To add a cron job
1. First write the job in the respective 6 columns in a file.
▫ echo “0 2 * * 1-5 tar cf /home/backp /home/projects” > mybackup_script
2. Pass the file to crontab
▫ crontab mybackup_script
To edit a job already added
1. Open the crontab in edit mode
▫ crontab -e
2. Edit the job
3. Save the changes
Check all the jobs for current user
• crontab -l
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Cron file organization
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Proxy servers
• Proxy servers acts as an intermediate
between the client and the server.
• They serve many purpose.
• Caching
• Anonymizing
• Load management
• Redirection
• Every client sends a request to the
proxy, the proxy checks if it can serve
the request from it’s cache otherwise
forward it.
• Proxy sometimes helps working with
firewalls.
2/27/2018
Gaurav Mishra <gmishx@gmail.com>
Setting up proxy on host
• Majority of the software support proxy
• The most common place to find the proxy setting is in the System environment
variable http_proxy, https_proxy, ftp_proxy.
• The variables can be set using the export command a given terminal session.
• They can also be set using the /etc/profile and /etc/bash.bashrc files for sessions
globally.
• The string follows following pattern:
▫ [username]:[password]@ipaddress:port
▫ http://[username]:[password]@address.com:port
2/27/2018

More Related Content

What's hot

Git lab installation guide
Git lab installation guideGit lab installation guide
Git lab installation guideRaiful Hasan
 
Boulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeckBoulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeckWill Sterling
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaJuan Diego Pereiro Arean
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleMichael Bahr
 
Apache development with GitHub and Travis CI
Apache development with GitHub and Travis CIApache development with GitHub and Travis CI
Apache development with GitHub and Travis CIJukka Zitting
 
under the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lessunder the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lesssarahnovotny
 
Dependencies and Licenses
Dependencies and LicensesDependencies and Licenses
Dependencies and LicensesRobert Reiz
 
Apache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleApache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleAmit Aggarwal
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chefkevsmith
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...SaltStack
 

What's hot (20)

Git lab installation guide
Git lab installation guideGit lab installation guide
Git lab installation guide
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Boulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeckBoulder dev ops-meetup-11-2012-rundeck
Boulder dev ops-meetup-11-2012-rundeck
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Nginx
NginxNginx
Nginx
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Apache development with GitHub and Travis CI
Apache development with GitHub and Travis CIApache development with GitHub and Travis CI
Apache development with GitHub and Travis CI
 
under the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lessunder the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or less
 
Dependencies and Licenses
Dependencies and LicensesDependencies and Licenses
Dependencies and Licenses
 
Apache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleApache Camel: Jetty Component With Example
Apache Camel: Jetty Component With Example
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Chef introduction
Chef introductionChef introduction
Chef introduction
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Deep dive networking
Deep dive networkingDeep dive networking
Deep dive networking
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...
 

Similar to Apache, cron and proxy

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Introduction to apache maven
Introduction to apache mavenIntroduction to apache maven
Introduction to apache mavenKrish
 
Securing Your WordPress Installation
Securing Your WordPress InstallationSecuring Your WordPress Installation
Securing Your WordPress InstallationLester Chan
 
Git Workshop : Git On The Server
Git Workshop : Git On The ServerGit Workshop : Git On The Server
Git Workshop : Git On The ServerWildan Maulana
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Rich Bowen
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor appRitik Malhotra
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!Cory Webb
 
Tips & Tricks in securing your WordPress installation
Tips & Tricks in securing your WordPress installationTips & Tricks in securing your WordPress installation
Tips & Tricks in securing your WordPress installationLester Chan
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamentalRajesh Kumar
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Rich Bowen
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansibleandrewmirskynet
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in UnityRifauddin Tsalitsy
 
How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes Thiago Leão Moreira
 
Exam Overview 70-533 Implementing Azure Infrastructure Solutions
Exam Overview 70-533 Implementing Azure Infrastructure SolutionsExam Overview 70-533 Implementing Azure Infrastructure Solutions
Exam Overview 70-533 Implementing Azure Infrastructure SolutionsGustavo Zimmermann (MVP)
 
Version control git - lecture-1
Version control git - lecture-1Version control git - lecture-1
Version control git - lecture-1Abdul Rahim
 
Liquibase via maven
Liquibase via mavenLiquibase via maven
Liquibase via mavenMaki Turki
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivityGregg Coppen
 

Similar to Apache, cron and proxy (20)

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Introduction to apache maven
Introduction to apache mavenIntroduction to apache maven
Introduction to apache maven
 
Securing Your WordPress Installation
Securing Your WordPress InstallationSecuring Your WordPress Installation
Securing Your WordPress Installation
 
Git Workshop : Git On The Server
Git Workshop : Git On The ServerGit Workshop : Git On The Server
Git Workshop : Git On The Server
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor app
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!
 
Tips & Tricks in securing your WordPress installation
Tips & Tricks in securing your WordPress installationTips & Tricks in securing your WordPress installation
Tips & Tricks in securing your WordPress installation
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes
 
Exam Overview 70-533 Implementing Azure Infrastructure Solutions
Exam Overview 70-533 Implementing Azure Infrastructure SolutionsExam Overview 70-533 Implementing Azure Infrastructure Solutions
Exam Overview 70-533 Implementing Azure Infrastructure Solutions
 
Version control git - lecture-1
Version control git - lecture-1Version control git - lecture-1
Version control git - lecture-1
 
Working with GIT
Working with GITWorking with GIT
Working with GIT
 
Liquibase via maven
Liquibase via mavenLiquibase via maven
Liquibase via maven
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivity
 

More from Gaurav Mishra

FOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and AutomationFOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and AutomationGaurav Mishra
 
FOSSology & GSOC Journey
FOSSology & GSOC JourneyFOSSology & GSOC Journey
FOSSology & GSOC JourneyGaurav Mishra
 
Block Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchangeBlock Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchangeGaurav Mishra
 
Block Chain - Introduction
Block Chain - IntroductionBlock Chain - Introduction
Block Chain - IntroductionGaurav Mishra
 
Disk quota and sysd procd
Disk quota and sysd procdDisk quota and sysd procd
Disk quota and sysd procdGaurav Mishra
 
Linux User Management
Linux User ManagementLinux User Management
Linux User ManagementGaurav Mishra
 
Firewall and IPtables
Firewall and IPtablesFirewall and IPtables
Firewall and IPtablesGaurav Mishra
 

More from Gaurav Mishra (11)

FOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and AutomationFOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and Automation
 
FOSSology & GSOC Journey
FOSSology & GSOC JourneyFOSSology & GSOC Journey
FOSSology & GSOC Journey
 
Block Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchangeBlock Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchange
 
Block Chain - Introduction
Block Chain - IntroductionBlock Chain - Introduction
Block Chain - Introduction
 
Backup using rsync
Backup using rsyncBackup using rsync
Backup using rsync
 
Disk quota and sysd procd
Disk quota and sysd procdDisk quota and sysd procd
Disk quota and sysd procd
 
Linux User Management
Linux User ManagementLinux User Management
Linux User Management
 
Linux Run Level
Linux Run LevelLinux Run Level
Linux Run Level
 
Firewall and IPtables
Firewall and IPtablesFirewall and IPtables
Firewall and IPtables
 
Linux securities
Linux securitiesLinux securities
Linux securities
 
wget, curl and scp
wget, curl and scpwget, curl and scp
wget, curl and scp
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

Apache, cron and proxy

  • 1. Gaurav Mishra <gmishx@gmail.com> Linux - 5 Apache Configuration file, Cron jobs, Proxy server 2/27/2018 Unrestricted
  • 2. Gaurav Mishra <gmishx@gmail.com> Apache http server • One of the most commonly used open source sever • Can be easily tuned • Works in harmony with PHP • Provides various security measures • Installs as httpd in many Linux distros • Packages as apache2 in Debian based distributions 2/27/2018
  • 3. Gaurav Mishra <gmishx@gmail.com> Apache directory structure • The apache foundation have their hierarchical structure for the respective configuration files. • The root is located at: /etc/apache2/ • The main configuration file is located at ./apache2.conf • The modules currently installed are located at: ./mods-available/ • The modules currently in use are located at: ./mods-enabled/ • The websites/virtual host available for current install are located at: ./sites-available/ • The websites/virtual host being used for current run are located at: ./sites-enabled/ 2/27/2018
  • 4. Gaurav Mishra <gmishx@gmail.com> Apache configuration file • The global configuration file is stored at /etc/apache2/apache2.conf • Can be overridden for each directory using .htaccess • The file contains directives, mostly distributed in directive blocks • Commonly used directive blocks: ▫ directory  Contains directives defined for a particular directory ▫ VirtualHost  Directives defined for a virtual host 2/27/2018
  • 5. Gaurav Mishra <gmishx@gmail.com> List of common directives • Alias • Allow • AllowOverride • AuthBasicAuthoritative • AuthType • Deny • <Directory> • DocumentRoot • <Else> • ErrorLog • ErrorLogFormat • <If> • <IfModule> • Include • KeepAlive • Listen • LoadModule • Redirect • RedirectMatch • ServerAdmin • ServerAlias • ServerLimit • ServerName • SSLCertificateFile • SSLCertificateKeyFile • SSLEngine • <VirtualHost> 2/27/2018
  • 6. Gaurav Mishra <gmishx@gmail.com> Setting up directory directive Alias “/holidaypics” “/var/www/html/newpics” <Directory /var/www/html/newpics> AuthType Basic AuthName Newpics AuthUserFile /web/users AuthGroupFile /web/groups <IfModule mod_dir.c> DirectoryIndex index.php </IfModule> <Files dinner.jpg> order deny,allow deny from all allow from 127.0.0.1 </Files> </Directory> 2/27/2018
  • 7. Gaurav Mishra <gmishx@gmail.com> Setting up VirtualHost • Virtual hosting allows the Apache web server to host multiple websites as part of its own. ServerName server.example.com ServerAlias server server2.example.com server2 ServerAlias *.example.com <VirtualHost server.example.com:80> Alias /files /home/user/Documents/files <Directory "/home/user/Documents/files"> AllowOverride None Options FollowSymLinks MultiViews </Directory> </VirtualHost> 2/27/2018
  • 8. Gaurav Mishra <gmishx@gmail.com> Setting up SSL support <IfModule mod_ssl.c> <VirtualHost *:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/certi.cer SSLCertificateKeyFile /etc/ssl/keys/certi.key </VirtualHost> </IfModule> 2/27/2018
  • 9. Gaurav Mishra <gmishx@gmail.com> Apache tools • To enable a website configuration from /etc/apache2/sites-available/mysite.conf ▫ a2ensite mysite • To disable a website configuration from /etc/apache2/sites-available/mysite.conf ▫ a2dissite mysite • To enable a module from /etc/apache2/mods-available/mymod.conf ▫ a2enmod mymod • To disable a module from /etc/apache2/mods-available/mymod.conf ▫ a2dismod mymod • Check the syntax of apache2.conf ▫ apachectl configtest 2/27/2018
  • 10. Gaurav Mishra <gmishx@gmail.com> Cron jobs • Cron jobs are set of actions which must be executed at a certain time on a given day. • Cron daemon keeps checking these cron jobs and execute them whenever required. • Each user can have their own cron jobs. • The job set by a user run with their privileges. • The cron jobs are stored in crontab files. 2/27/2018
  • 11. Gaurav Mishra <gmishx@gmail.com> Crontab format • The format of a crontab field follows: ▫ minute hour day-month month day(s)-week task • A crontab entry has six fields: ▫ The first five are used to specify the time for an action  The first field specifies the minute (0–59)  The second field specifies the houst (0-23)  The third field specifies the day of the month (1–31)  The fourth field specifies the month of the year (1–12, or month prefixes like Jan and Sep)  And the fifth field specifies the day of the week (0–6, or day prefixes like Wed and Fri), starting with 0 as Sunday. ▫ The last field is the action itself. • Each field can be defined as range or using * to match all 2/27/2018
  • 12. Gaurav Mishra <gmishx@gmail.com> Crontab examples • Take backup at 2:00 AM from Mon-Friday of every month ▫ 0 2 * * 1-5 tar cf /home/backp /home/projects • Take backup at 2:00 AM on Sun, Wed, Fri of every month ▫ 0 2 * * 0,3,5 tar cf /home/backp /home/projects • Take backup every other day at 2:00 AM on any day ▫ 0 2 */2 * * tar cf /home/backp /home/projects 2/27/2018
  • 13. Gaurav Mishra <gmishx@gmail.com> Adding a cron job To add a cron job 1. First write the job in the respective 6 columns in a file. ▫ echo “0 2 * * 1-5 tar cf /home/backp /home/projects” > mybackup_script 2. Pass the file to crontab ▫ crontab mybackup_script To edit a job already added 1. Open the crontab in edit mode ▫ crontab -e 2. Edit the job 3. Save the changes Check all the jobs for current user • crontab -l 2/27/2018
  • 14. Gaurav Mishra <gmishx@gmail.com> Cron file organization 2/27/2018
  • 15. Gaurav Mishra <gmishx@gmail.com> Proxy servers • Proxy servers acts as an intermediate between the client and the server. • They serve many purpose. • Caching • Anonymizing • Load management • Redirection • Every client sends a request to the proxy, the proxy checks if it can serve the request from it’s cache otherwise forward it. • Proxy sometimes helps working with firewalls. 2/27/2018
  • 16. Gaurav Mishra <gmishx@gmail.com> Setting up proxy on host • Majority of the software support proxy • The most common place to find the proxy setting is in the System environment variable http_proxy, https_proxy, ftp_proxy. • The variables can be set using the export command a given terminal session. • They can also be set using the /etc/profile and /etc/bash.bashrc files for sessions globally. • The string follows following pattern: ▫ [username]:[password]@ipaddress:port ▫ http://[username]:[password]@address.com:port 2/27/2018