• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • 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