Take a friendly, non-technical approach to installing, configuring, and maintaining a web server for development and testing on Mac OS, Linux, and Windows. This new edition uses straightforward language to demystify the mechanics of the web, leading the reader through a complex topic via simple, iterative steps. The book reflects current, relevant Apache configurations and web application frameworks, and prepares the reader for working in professional web development environments.You'll begin by reviewing a brief history of Apache that focuses on the necessary foundation to understand what these web servers are and why they are used. You'll then install a basic Apache setup on your operating system that loads a static HTML file for display in a browser. Next you'll work through progressively more detailed configurations towards a modern, secure application development environment for the two most commonly implemented development frameworks: a PHP-based framework such as Laravel or a NodeJS application.In the end, Apache Essentials, second edition will show novice web developers and UX professionals how to quickly and confidently build and test their website changes safely and securely.You will:• Install and configure Apache to support your development• Support common development frameworks using specific configuration guides • Set up a secure web server for testing• Use logs for troubleshooting and why that’s important Table of Contents About the Author About the Technical Reviewer Acknowledgments Introduction Chapter 1: Getting Started with Apache How Web Servers Work The HyperText Transfer Protocol A (Very) Brief History of Apache Before You Begin... Keep Notes Get Familiar with Your Terminal Be Prepared to Read Documentation What to Know Before Installing Apache Using the Right Development Environment Apache vs. Other Web Servers Choosing Apache Over Nginx Apache over npm start for Node Development Obtaining Apache Installing Apache on macOS Installing Apache Through Homebrew Running Apache as a Service Through Homebrew Installing Apache on Linux Choosing the Source Installation The Benefit of Binary Installation Installing on Windows Installing Apache Through XAMPP Installing Apache as a Service in Windows Basic Configuration Where to Put Your Website Files Configuration Directory Structure httpd.conf/apache2.conf mime.types Configuring a Default Site Summing It Up Chapter 2: Configuration Essentials How Apache’s Configuration Is Structured Where Do I Find Modules? Installing Modules Adding File Types Configuring Modules All About Directives Directive Configuration DocumentRoot /var/www Configuring Your Primary Apache Site Creating the New Directory Updating Your Apache Configuration Updating the Location of Your Website’s Files Directory Options Configuring Your Primary Index File Configuring Logging Using .htaccess Files Other Configuration Options You Should Know Rewriting URLs Using URL Slugs Updating the URL for an Existing Page Fixing a Trailing Slash Creating Custom Error Messages ErrorDocument Syntax Redirecting to External Error Documents Authenticating Users Through Apache Creating a .htpasswd File Basic Configuration Adding New File Types Configuring mime.types Including External Configuration Files Applying Changes Summing It Up Chapter 3: Configuring Virtual Hosts A Quick and Dirty Guide to Domains What Are Virtual Hosts? Creating Development Domains Using the hosts File to Manage Local Domains Using ngrok to Manage Local Domains Setting up a Subdomain Pointing to Your Local Environment Why Develop Locally? Configuring Apache’s Virtual Hosts A Sample Apache Configuration ServerAdmin DocumentRoot ServerName and ServerAlias ErrorLog and CustomLog ScriptAlias Directory Using Separate Configuration Files Putting It All to Work Pointing the Virtual Domains to Your Local Computer Configuring Apache for Multiple Virtual Hosts Summing It Up Chapter 4: Scripting Languages PHP Installing PHP Installing PHP on macOS Installing PHP on Linux Configuring Apache for PHP On macOS On Linux Configuring PHP Updating Default Configuration Increasing the Memory Usage Limit Increasing the Upload File Size Configuring Noisy Error Reporting Increasing Max Execution Time Installing PHP Extensions Recommended php.ini Testing It Out Configuring Node.js on Apache Configuring Your Node.js Application for Apache Installing pm2 Configuring the Application Adding Your Application as a Service Configuring Apache’s Reverse Proxy Enabling Apache’s Proxy Modules On macOS and Windows On Linux Creating a Virtual Host Configuration Testing It Out Configuring React Apps on Apache Summing It Up Chapter 5: Securing Your Setup SSL at a Glance Configuring SSL for Subdomains Installing Certbot On macOS On Linux On Windows Running Certbot Configuring HTTPS for Local Domains Setting up a Local SSL Certificate Authority Installing OpenSSL macOS Linux Windows Storing Your Certificates Generating the CA Private Key Creating a Public CA Certificate Signing Your Own Certificates The sign.sh Script Configuring Apache for HTTPS Creating a Separate Configuration File Loading the SSL Module Configuring the Apache’s SSL Module Configuring the Global Options Configuring the Secure Site in Apache Summing It Up Chapter 6: Log Files Error.log Configuring the Error Log access.log Formatting the Access Log Where Can I Find Apache’s Log Files? Configuring Apache Logs Log Files for Virtual Hosts Rotating Logs Configuring Log Rotation Reading Archived Log Files What Do I Do with Log Files? Using Log Analysis Programs Creating Custom Scripts Apache Configuration Tracking Down 404 Errors and Why They Occur Troubleshooting PHP Writing to the Error Log An Example Summing It Up Chapter 7: Sample Apache Configurations Basic Apache Configuration (with PHP) httpd.conf Basic HTTPS Configuration httpd.conf extra/httpd-ssl.conf Adding Rewrite Rules to Provide Human-Readable URLs .htaccess Setting up Multiple Hosts (One PHP and One Node.js) httpd.conf macOS and Windows Linux portfolio.local.conf nodejs.local.conf Protected Directory httpd.conf macOS and Windows Linux dev.mydomain.com.conf Epilogue Appendix: HTTP Status Codes HTTP Status Codes 1xx Informational Response 2xx Success 3xx Redirection 4xx Client Errors 5xx Server Errors Index Take a friendly, non-technical approach to installing, configuring, and maintaining a web server for development and testing on Mac OS, Linux, and Windows. This new edition uses straightforward language to demystify the mechanics of the web, leading the reader through a complex topic via simple, iterative steps. The book reflects current, relevant Apache configurations and web application frameworks, and prepares the reader for working in professional web development environments. You'll begin by reviewing a brief history of Apache that focuses on the necessary foundation to understand what these web servers are and why they are used. You'll then install a basic Apache setup on your operating system that loads a static HTML file for display in a browser. Next you'll work through progressively more detailed configurations towards a modern, secure application development environment for the two most commonly implemented development frameworks: a PHP-based framework such as Laravel or a NodeJS application. In the end, Apache Essentials, second edition will show novice web developers and UX professionals how to quickly and confidently build and test their website changes safely and securely. What You'll LearnInstall and configure Apache to support your developmentSupport common development frameworks using specific configuration guides Set up a secure web server for testingUse logs for troubleshooting and why that's importantWho This Book Is ForUX professionals who are looking for a more technical foundation to inform their workFront-end developers who want to set up a quick development environment. Junior developers who are expanding their knowledge of DevOps. Bootcamp graduates who need a better understanding of the systems they are using * Covers the most up-to-date versions of the technology. * Teaches subject using real world tutorials. * Subject is taught in a very concise, no-nonsense fashion, wasting little time on history and other fluff. Book is therefore compact and portable. It gives you just what you need. * Demystifies what is sometimes thought of as an intimidating subject. * Covers Apache for Windows, Mac/Unix, and Linux. * Full book support available online and via e-mail.