YII application Apache configuration is relatively simple, nginx configuration mainly need to deal with a single entry file, which corresponds to the Apache configuration in the following sentence:
# If a directory or a file exists, use it directlyrewritecond%{request_filename}!-frewritecond%{request_filename}!-d# Otherwise forward it to index.phprewriterule. index.php
Need to translate to the corresponding nginx instructions. Examples are as follows:
server { listen; server_name www.techbrood.com; Access_log Logs/techbrood.access.log; Root/var/www/html/techbrood/web; Location/{ index index.php; if (!-e $request _filename) { rewrite ^/(. *)/index.php last; } } Location ~ \.php (? | $) { #fastcgi (PHP-FPM) listening on 127.0.0.1:9000 root/var/www/html/techbrood/web; #your path to fastcgi_params file include/etc/nginx/conf/fastcgi_params; Fastcgi_index index.php; Fastcgi_param script_filename $document _root$fastcgi_script_name; Fastcgi_pass 127.0.0.1:9000; #fastcgi_pass Unix:/var/run/php-fpm.sock } location ~ \. ( Jpg|jpeg|gif|css|png|js|ico|html|xml|txt) $ { root/var/www/html/techbrood/web; }}
by Iefreer
The above describes the CENTOS6 system on the YII/YII2/NGINX/PHP-FPM configuration examples, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.