- NGINX Cookbook
- Tim Butler
- 201字
- 2021-07-03 00:04:23
How it works...
For the most part, the configuration is the same as the static website configuration in Chapter 1, Let's Get Started. For the root URL call, we have a new try_files directive, which will attempt to load the files in the order specified, but will fall back to the last parameter if they all fail.
For this WordPress example, it means that any static files will be served if they exist on the system, then fall back to /index.php?args if this fails.
The args rewrite allows the permalinks of the site to be in a much more human form. For example, if you have a working WordPress installation, you can see links such as the one shown in the following screenshot:

Lastly, we process all PHP files via the FastCGI interface to PHP-FPM. In the preceding example, we're referencing the Ubuntu/Debian standard; if you're running CentOS/RHEL, then the path will be /var/run/php-fpm.sock.
NGINX is simply proxying the connection to the PHP-FPM instance, rather than being part of NGINX itself. This separation allows for greater resource control, especially since the number of incoming requests to the web server doesn't necessarily match the number of PHP requests for a typical website.
- Mastering Entity Framework Core 2.0
- Web前端開發技術:HTML、CSS、JavaScript(第3版)
- 看透JavaScript:原理、方法與實踐
- HTML5游戲開發案例教程
- PostgreSQL 11從入門到精通(視頻教學版)
- INSTANT Mercurial SCM Essentials How-to
- 人人都是網站分析師:從分析師的視角理解網站和解讀數據
- Learning Nessus for Penetration Testing
- Anaconda數據科學實戰
- Java 9 with JShell
- Java Web 從入門到項目實踐(超值版)
- Unity與C++網絡游戲開發實戰:基于VR、AI與分布式架構
- Learning Rust
- Bootstrap for ASP.NET MVC(Second Edition)
- Java編程兵書