Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Nginx HTTP Server

You're reading from   Nginx HTTP Server Harness the power of Nginx to make the most of your infrastructure and serve pages faster than ever before

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher Packt
ISBN-13 9781788623551
Length 348 pages
Edition 4th Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
 Fjordvald Fjordvald
Author Profile Icon Fjordvald
Fjordvald
 Nedelcu Nedelcu
Author Profile Icon Nedelcu
Nedelcu
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Title Page
Dedication
Packt Upsell
Contributors
Preface
1. Downloading and Installing Nginx FREE CHAPTER 2. Basic Nginx Configuration 3. HTTP Configuration 4. Module Configuration 5. PHP and Python with Nginx 6. Nginx as an Application Server 7. Apache and Nginx Together 8. From Apache to Nginx 9. Introduction to Load Balancing and Optimization 10. Case Studies 11. Troubleshooting 1. Other Books You May Enjoy Index

nginScript


nginScript (pronounced engine script) is essentially a subset of ECMA 5.1 JavaScript with a few ECMA 6.0 extensions implemented. It is available in two versions, ngx_http_js_module for standard HTTP usage and ngx_stream_js_module for TCP stream usage. Make sure one or both of these are included in your Nginx compile, if you're not sure, you can check by using nginx -V | grep js_module in a terminal or by seeing if your main configuration file is loading either module dynamically.

nginScript works by implementing handlers that are passed two arguments, the client request and the client response. This allows you full access to the HTTP request to access and manipulate data. Additionally, nginScript allows you to assign nginScript function output to normal Nginx variables that can be used with the standard directives:

js_include http.js;

js_set $foo foo; // Function implemented in http.js
js_set $summary summary; // Function implemented in http.js

server {
    listen 8000;

    location...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images