官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 蒲江县| 康保县| 屯昌县| 响水县| 黎川县| 华安县| 海门市| 屏东县| 石屏县| 铜鼓县| 双峰县| 忻州市| 廊坊市| 濮阳市| 宜川县| 济宁市| 碌曲县| 修水县| 武山县| 伊川县| 林芝县| 英超| 大理市| 双城市| 清水县| 新闻| 玉门市| 土默特右旗| 阳泉市| 义乌市| 海丰县| 西充县| 县级市| 察哈| 秀山| 浑源县| 日喀则市| 永平县| 威海市| 江陵县| 华容县|