Apache and Nginx configurations
Apache
Yii is ready to work with a default Apache web server configuration. The .htaccess
files in Yii framework and application folders restrict access to the restricted resources. To hide the bootstrap file (usually index.php
) in your URLs you can add mod_rewrite
instructions to the .htaccess
file in your document root or to the virtual host configuration:
Nginx
You can use Yii with Nginx and PHP with FPM SAPI. Here is a sample host configuration. It defines the bootstrap file and makes yii catch all requests to unexisting files, which allows us to have nice-looking URLs.
Using this configuration you can set cgi.fix_pathinfo=0
in php.ini to avoid many unnecessary system stat() calls.