Igor Yavych asked:
I’m trying to get server work in the way nginx->apache2.4->php-fpm(via mod_proxy_fcgid) (nginx for serving static files) (I’m not sure apache is even needed now). It works but I got few questions.
When I used apache2.2 with php as apache module (on old server) I could set php_admin_value like for each virtual host for example
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]". Now when I’m using php-fpm apache doesn’t understand those and won’t start. How can I set these values for each virtual host while using php-fpm?
Second question is, how do I make _SERVER[“REMOTE_ADDR”] filled with real remote address? With nginx+apache+php as apache module it was solved with mod rpaf, but as of now _SERVER[“REMOTE_ADDR”] displays 127.0.0.1.
Last question. If I decide to just go nginx+php-fpm what “essential” functionality I will lose by discarding apache?
Apparently mod_rpaf wasn’t doing what it was supposed to do. Apache actually provides official mod with similar functionality for 2.4. In case someone will need it too, here is how you get it:
1. wget https://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/metadata/mod_remoteip.c
2. apxs -cia mod_remoteip.c
3. Enable mod LoadModule remoteip_module usr/lib/apache2/modules/mod_remoteip.so
4. Configure mod
<IfModule remoteip_module> RemoteIPHeader X-Real-IP RemoteIPInternalProxy 127.0.0.1 </IfModule>
Note: Step 4 Depends on your nginx setup. I assume it would work with X-Forwarded-To too.
With this, problem #2 is solved.
These options can be set in pools’ configuration files as
php_admin_value[open_basedir] for example. This requires separate pool for each virtual host which is IMO not that great but since I only have 4 virtual hosts it doesn’t get too messy.
And so, problem #1 is solved.
This can be set with:
fastcgi_param PHP_VALUE 'sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"';
If you have multiple values to pass, they must all be in the same
PHP_VALUE, separated by
fastcgi_param PHP_VALUE 'allow_url_fopen 0\nmemory_limit 64M'
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.