• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question PHP-FPM served by Nginx vs. Apache (again)

lema

New Pleskian
Server operating system version
Debian 11.11
Plesk version and microupdate number
Plesk Obsidian 18.0.67 Update #3 Web Host Edition
After searching and reading all related posts on the forum, my question remains unanswered.... :confused:
Could someone explain how PHP-FPM served by Nginx vs. Apache works?

The two setups I am testing are:

1. FPM application served by Nginx

Proxy mode = ON
Smart static files processing = ON
Serve static files directly by Nginx = ON
Enable Nginx caching = ON
The phpinfo() output shows: $_SERVER['SERVER_SOFTWARE'] => nginx/1.26.2,
2025-03-08_02-35-47.PNG
and .htaccess works normally!



2. FPM application served by Apache

Proxy mode = ON
Smart static files processing = ON
Serve static files directly by Nginx = ON
Enable Nginx caching = ON
The phpinfo() output shows: $_SERVER['SERVER_SOFTWARE'] => Apache,
2025-03-08_02-36-29.PNG
and .htaccess works normally!

The only difference in the setups is nginx / Apache.

For testing, my .htaccess file only contains: Options -Indexes

If I disable Proxy mode, the processing of .htaccess files stops, but in all other cases, it works normally.
Is this the expected behavior, or am I missing something fundamental ??
 
"Proxy mode" means that Nginx is a front end web server that handles all static requests but passes all dynamic requests to Apache as a backend. If you disable proxy mode, all requests are handled by Nginx only. Nginx does not honor .htaccess files. To apply .htaccess rules to Nginx, they must be converted into Nginx syntax and must be added as individual configuration directives to the Nginx configuration. .htaccess is only good for Apache.

When you select PHP-FPM served by Nginx, all .php files are interpreted by Nginx and requests to .php files never reach Apache, regardless of proxy mode. When you select PHP-FPM served by Apache, all .php files are interpreted by Apache. The advantage of .php handling via Nginx is that it's faster. You can still have proxy mode on for other purposes, e.g. when you don't want to translate .htaccess rules that apply to directory redirects. However, with PHP-FPM served by nginx and .htaccess rules that affect .php files, these won't work, because Nginx has processed the .php files and won't pass such requests to Apache. Other .htaccess rules will still work, because other requests will still be passed to Apache.
 
@Bitpalast, Absolutely understood, now it makes sense!

I made a few tests with the .htaccess file, which contains the following:

Code:
Options +Indexes

<Files *.php>
  deny from all
</Files>

The Options +Indexes always executes, while the deny from all works only with "FPM application served by Apache".
 
Back
Top