Leanpub Header

Skip to main content

Servers for Hackers

Server Administration for Programmers

Don’t get stuck at 3am with a broken server, or in the middle of your workday fighting configuration. Learn how to administer your servers!

This book is available in multiple packages!

Pick Your Package
PDF
EPUB
WEB
356
Pages
84,938Words
About

About

About the Book

Don't catch Accidental Sysadmin Syndrome™

Application development is getting more complex, and we developers need to know how to setup and maintain the servers that run our applications. Don’t get stuck at 3am with a broken server, or in the middle of your workday fighting configuration. Learn how to administer your servers!

Run & Manage Web Servers

Learn how to install and configure Nginx, Apache so you can serve your web applications.

Multi-Server Setup

Learn how to connect multiple servers so they can work together for load balancing, caching, redundancy and more.

Latest Technologies

Learn how to install and manage the latest technologies, including setting up queues/workers, monitoring processes so they don’t fail, handling server and applications logging and more!

Setup and Security

Learn how to setup each server with needed software and security configuration to keep your applications and their data safe.

This includes preventing unauthorized access, managing permissions and users, learning how to use the iptables firewall, configuring SSH, enabling SSL certificates and more!

Case Studies

Read the case studies to learn from specific examples from real-world usage.

These includes examples of load balancing, web server configuration, caching and more!

Share this book

Packages

Pick Your Package

All packages include the ebook in the following formats: PDF, EPUB, and Web

The Book

Minimum price

Suggested price$55.00

The Servers for Hackers eBook, including 35+ chapters and over 300 pages of information programmers need to know about their servers!

$45.00

    The Book + Case Studies

    Minimum price

    Suggested price$70.00

    In addition to the content of the Servers for Hackers eBook, you'll receive the case studies with examples of real-world use of examples in the book!

    $59.00

    • Case Studies
      Examples of real-world use of configurations found in the book (and some extras)!

    This book is also available in the following packages:

    • The Book, Case Studies & Videos

      In addition to the Servers for Hackers eBook and the Case Studies, you'll receive 12+ instructional videos on Ansible, SSL Certificates, Vagrant, and Supervisord.

      • Case Studies
        Examples of real-world use of configurations found in the book (and some extras)!
      • Videos
        16 Instructional Videos on topics related to the Servers for Hackers eBook, including Ansible, Supervisord, SSL certificates in production, using Vagrant and Server Setup! An example Vagrant file, Nginx configuration and OSX Mavericks install script for DNSMasq is included.
      Minimum price
      $99.99
      Suggested price
      $120.00

    Author

    About the Author

    Chris Fidao

    Coding in the PHP world for 10 years, Chris has much experience in architecting and structuring applications large and small.

    Chris immediately jumped on board with Laravel 4 when he discovered it's rare mixture of ease-of-use and ingrained support for enterprise-grade code architecture.

    You can find Chris blogging about Laravel and coding at fideloper.com and writing about servers at serversforhackers.com. He loves digging into the code to find the perfectly crafted solution.

    Chris  works at UserScape, supporting and developing HelpSpot.

    Leanpub Podcast

    Episode 107

    An Interview with Chris Fidao

    Contents

    Table of Contents

    Servers

    1. Video Site
    2. Book Issues
    3. Introduction

    Accidental Sysadmin Syndrome

    1. Assumptions

    Linux Distributions

    1. Popularity is Relative

    The Sandbox

    1. Install Virtualbox and Vagrant
    2. Configure Vagrant
    3. Vagrant Up!
    4. Basic Commands
    5. Basic Software
    6. Review
    7. Security

    Users and Access

    1. IP Addresses
    2. Creating a New User
    3. Making Our User a Super User

    Setting Up the Firewall: Iptables

    1. Adding these rules
    2. Inserting Rules
    3. Deleting Rules
    4. Saving Firewall Rules
    5. Defaulting to DROP Over ACCEPT
    6. Logging Dropped Packets
    7. Firewalls with UFW

    Fail2Ban

    1. Iptables Integration
    2. Installation
    3. Configuration

    Automatic Security Updates

    1. Package Managers

    Apt

    1. New (as of 16.04 Xenial, continuing into 18.04 Bionic)
    2. Installing
    3. Repositories
    4. Examples
    5. Searching Packages
    6. Permissions and User Management

    Permissions

    1. Checking Permissions
    2. Changing Permissions

    User Management

    1. Creating Users
    2. Umask & Group ID Bit
    3. ACL’s
    4. Running Processes
    5. Webservers

    HTTP, Web Servers and Web Sites

    1. A Quick Note on DNS

    DNS & Hosts File

    1. Xip.io
    2. Virtual Hosts

    Hosting Web Applications

    1. Three Actors

    Apache

    1. Installing
    2. Configuration
    3. Why the numbers in the filenames?
    4. Apache2 Tools
    5. Virtual Hosts
    6. Apache and Web Applications
    7. MPM Configuration
    8. Security Configuration
    9. Envvars

    Nginx

    1. Features
    2. Installation
    3. Web Server Configuration
    4. Servers (virtual hosts)
    5. Integration with Web Applications

    PHP

    1. Installation
    2. Configuration
    3. PHP-FPM
    4. PHP in Nginx: Subdirectories

    Server Setup for Multi-Tenancy Apps

    1. DNS
    2. Multi-Tenancy in Apache
    3. Multi-Tenancy in Nginx
    4. SSL Certificates

    SSL Overview

    1. Using SSL in Your Application

    Creating Self-Signed Certificates

    1. Heartbleed & Friends
    2. Creating a Wildcard Self-Signed Certificate
    3. Apache Setup
    4. “Server’s certificate does not match the URL.”
    5. Nginx Setup
    6. One Server Block

    Extra SSL Tricks

    LetsEncrypt

    1. Web Server Security
    2. Install Letsencrypt
    3. Install a Certificate
    4. Nginx Configuration
    5. Renewal
    6. Multi-Server Environments

    Implications of Multi-Server Environments

    1. Asset Management
    2. Sessions
    3. Lost Client Information
    4. SSL Traffic
    5. Logs

    Load Balancing with Nginx

    1. Balancing Algorithms
    2. Configuration
    3. Mapping Headers

    SSL with Nginx

    1. SSL-Termination
    2. SSL-Passthru Support
    3. When to use Pass-Thru
    4. Load Balancer (Server A, at 52.90.130.140):
    5. Web Server (Server B, at 52.23.215.245):

    Load Balancing with HAProxy

    1. Common Setups
    2. Installation
    3. HAProxy Configuration
    4. Monitoring HAProxy
    5. Sample NodeJS Web Server

    SSL with HAProxy

    1. HAProxy with SSL Termination
    2. HAProxy with SSL Pass-Through
    3. Sample NodeJS Web Server
    4. Web Cache

    Nuts and Bolts of HTTP Caching

    1. Object Caches
    2. Web Caches
    3. Types of HTTP Caches

    An Origin Server

    1. Testing Caching Mechanisms

    Nginx Web Caching

    1. Use Cases
    2. How It Will Work
    3. Origin Server
    4. Cache Server
    5. Proxy Caching
    6. Example: Caching Specific URIs

    Varnish

    1. Origin Server
    2. Install Varnish
    3. Basic Configuration
    4. Increasing Cache Hit Rate
    5. Varnish Tools
    6. Extra Resources
    7. Logs

    Logrotate

    1. What does Logrotate do?
    2. Configuring Logrotate
    3. Going Further

    Rsyslog

    1. Configuration
    2. Usage
    3. Should I Use Rsyslog?
    4. Sending To Rsyslog From An Application
    5. File Management, Deployment & Configuration Management

    Managing Files

    1. Copying Files Locally
    2. SCP: Secure Copy
    3. Rsync: Sync Files Across Hosts
    4. Deployment

    Auto-deploy with GitHub

    1. How it Works
    2. Node Listener
    3. Shell Script
    4. Putting it together
    5. Firewall

    Configuration Management with Ansible

    1. Install
    2. Managing Servers
    3. Basic: Running Commands
    4. Basic Playbook
    5. Roles
    6. Facts
    7. Vault
    8. SSH

    Logging in

    SSH Config

    SSH Tunneling

    1. Local Port Forwarding
    2. Remote Port Forwarding

    One-Off Commands & Multiple Servers

    1. Basic Ansible
    2. Monitoring Processes

    A Sample Script

    System Services

    1. System V Init (SysVinit, SysV)
    2. Systemd
    3. Upstart
    4. The Service Command
    5. Using These Systems

    Supervisord

    1. A Chain of Process Monitors
    2. Installation
    3. Configuration
    4. Controlling Processes
    5. Web Interface

    Forever

    1. Installation
    2. Usage

    Circus

    1. Installation
    2. Configuration
    3. Controlling Processes
    4. Web Interface
    5. Starting on Boot
    6. Development and Servers

    Serving Static Content

    1. Built-In
    2. NodeJS
    3. Dynamic Content

    Get the free sample chapters

    Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

    The Leanpub 60 Day 100% Happiness Guarantee

    Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

    Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

    You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

    So, there's no reason not to click the Add to Cart button, is there?

    See full terms...

    Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

    We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

    (Yes, some authors have already earned much more than that on Leanpub.)

    In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

    Learn more about writing on Leanpub

    Free Updates. DRM Free.

    If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

    Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

    Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

    Learn more about Leanpub's ebook formats and where to read them

    Write and Publish on Leanpub

    You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

    Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

    Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

    Learn more about writing on Leanpub