Nginx: .user.ini per directory PHP configuration

Apache has .htaccess handling, but if you want to set PHP configuration per directory on a website served by Nginx, you may think you are stuck.

If you don't want to mess with your Nginx server config or per pool .ini files, you can get PHP configuration values on a per-directory basis into your scripts by using a .user.ini file in the relevant directory, for PHP 5.3 onwards.
This is especially useful if you are running applications in directories, each with their own specific PHP or environment requirements.

Upload a file called .user.ini to the relevant directory and include a standard set of PHP ini configuration settings in it:

e.g

upload_max_filesize = 2M
post_max_size = 3M

Reload php-fpm or wait for the .user.ini TTL to hit and you should see these updated settings available to your scripts.

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments