Servers for Hackers
Server Administration for Programmers
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!
Packages
Pick Your Package
All packages include the ebook in the following formats: PDF, EPUB, and Web
The Book
Minimum price
Suggested price$55.00The 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.00In 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 StudiesExamples 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 StudiesExamples of real-world use of configurations found in the book (and some extras)!
- Videos16 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
- Case Studies
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.

Episode 107
An Interview with Chris Fidao
Contents
Table of Contents
Servers
- Video Site
- Book Issues
- Introduction
Accidental Sysadmin Syndrome
- Assumptions
Linux Distributions
- Popularity is Relative
The Sandbox
- Install Virtualbox and Vagrant
- Configure Vagrant
- Vagrant Up!
- Basic Commands
- Basic Software
- Review
- Security
Users and Access
- IP Addresses
- Creating a New User
- Making Our User a Super User
Setting Up the Firewall: Iptables
- Adding these rules
- Inserting Rules
- Deleting Rules
- Saving Firewall Rules
- Defaulting to DROP Over ACCEPT
- Logging Dropped Packets
- Firewalls with UFW
Fail2Ban
- Iptables Integration
- Installation
- Configuration
Automatic Security Updates
- Package Managers
Apt
- New (as of 16.04 Xenial, continuing into 18.04 Bionic)
- Installing
- Repositories
- Examples
- Searching Packages
- Permissions and User Management
Permissions
- Checking Permissions
- Changing Permissions
User Management
- Creating Users
- Umask & Group ID Bit
- ACL’s
- Running Processes
- Webservers
HTTP, Web Servers and Web Sites
- A Quick Note on DNS
DNS & Hosts File
- Xip.io
- Virtual Hosts
Hosting Web Applications
- Three Actors
Apache
- Installing
- Configuration
- Why the numbers in the filenames?
- Apache2 Tools
- Virtual Hosts
- Apache and Web Applications
- MPM Configuration
- Security Configuration
- Envvars
Nginx
- Features
- Installation
- Web Server Configuration
- Servers (virtual hosts)
- Integration with Web Applications
PHP
- Installation
- Configuration
- PHP-FPM
- PHP in Nginx: Subdirectories
Server Setup for Multi-Tenancy Apps
- DNS
- Multi-Tenancy in Apache
- Multi-Tenancy in Nginx
- SSL Certificates
SSL Overview
- Using SSL in Your Application
Creating Self-Signed Certificates
- Heartbleed & Friends
- Creating a Wildcard Self-Signed Certificate
- Apache Setup
- “Server’s certificate does not match the URL.”
- Nginx Setup
- One Server Block
Extra SSL Tricks
LetsEncrypt
- Web Server Security
- Install Letsencrypt
- Install a Certificate
- Nginx Configuration
- Renewal
- Multi-Server Environments
Implications of Multi-Server Environments
- Asset Management
- Sessions
- Lost Client Information
- SSL Traffic
- Logs
Load Balancing with Nginx
- Balancing Algorithms
- Configuration
- Mapping Headers
SSL with Nginx
- SSL-Termination
- SSL-Passthru Support
- When to use Pass-Thru
- Load Balancer (Server A, at 52.90.130.140):
- Web Server (Server B, at 52.23.215.245):
Load Balancing with HAProxy
- Common Setups
- Installation
- HAProxy Configuration
- Monitoring HAProxy
- Sample NodeJS Web Server
SSL with HAProxy
- HAProxy with SSL Termination
- HAProxy with SSL Pass-Through
- Sample NodeJS Web Server
- Web Cache
Nuts and Bolts of HTTP Caching
- Object Caches
- Web Caches
- Types of HTTP Caches
An Origin Server
- Testing Caching Mechanisms
Nginx Web Caching
- Use Cases
- How It Will Work
- Origin Server
- Cache Server
- Proxy Caching
- Example: Caching Specific URIs
Varnish
- Origin Server
- Install Varnish
- Basic Configuration
- Increasing Cache Hit Rate
- Varnish Tools
- Extra Resources
- Logs
Logrotate
- What does Logrotate do?
- Configuring Logrotate
- Going Further
Rsyslog
- Configuration
- Usage
- Should I Use Rsyslog?
- Sending To Rsyslog From An Application
- File Management, Deployment & Configuration Management
Managing Files
- Copying Files Locally
- SCP: Secure Copy
- Rsync: Sync Files Across Hosts
- Deployment
Auto-deploy with GitHub
- How it Works
- Node Listener
- Shell Script
- Putting it together
- Firewall
Configuration Management with Ansible
- Install
- Managing Servers
- Basic: Running Commands
- Basic Playbook
- Roles
- Facts
- Vault
- SSH
Logging in
SSH Config
SSH Tunneling
- Local Port Forwarding
- Remote Port Forwarding
One-Off Commands & Multiple Servers
- Basic Ansible
- Monitoring Processes
A Sample Script
System Services
- System V Init (SysVinit, SysV)
- Systemd
- Upstart
- The Service Command
- Using These Systems
Supervisord
- A Chain of Process Monitors
- Installation
- Configuration
- Controlling Processes
- Web Interface
Forever
- Installation
- Usage
Circus
- Installation
- Configuration
- Controlling Processes
- Web Interface
- Starting on Boot
- Development and Servers
Serving Static Content
- Built-In
- NodeJS
- 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.