Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable PHP FPM status page on /php-fpm-status #188

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 3.9.0 (not released yet)

* Increase the number of FPM worker from 4 to 25
* Enabled PHP FPM status page on `/php-fpm-status`

## 3.8.0 (2022-06-15)

* Add documentation cookbook for using pg_activity
Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,44 @@ services:

</details>

### How to use PHP FPM status page?

<details>

<summary>Read the cookbook</summary>

If you wan to use the [PHP FPM status
page](https://www.php.net/manual/en/fpm.status.php) you need to remove a
configuration block in the
`infrastructure/docker/services/frontend/etc/nginx/nginx.conf` file:

```diff
- # Remove this block if you want to access to PHP FPM monitoring
- # dashboarsh (on URL: /php-fpm-status). WARNING: on production, you must
- # secure this page (by user IP address, with a password, for example)
- location ~ ^/php-fpm-status$ {
- deny all;
- }
-
```

And if your application uses the front controller pattern, and you want to see
the real request URI, you also need to uncomment the following configuration
block:

```diff
- # # Uncomment if you want to use /php-fpm-status endpoint **with**
- # # real request URI. It may have some side effects, that's why it's
- # # commented by default
- # fastcgi_param SCRIPT_NAME $request_uri;
+ # Uncomment if you want to use /php-fpm-status endpoint **with**
+ # real request URI. It may have some side effects, that's why it's
+ # commented by default
+ fastcgi_param SCRIPT_NAME $request_uri;
```

</details>

### How to pg_activity for monitoring PostgreSQL

<details>
Expand Down
11 changes: 11 additions & 0 deletions infrastructure/docker/services/frontend/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ http {
add_header Cache-Control "no-cache";
}

# Remove this block if you want to access to PHP FPM monitoring
# dashboard (on URL: /php-fpm-status). WARNING: on production, you must
# secure this page (by user IP address, with a password, for example)
location ~ ^/php-fpm-status$ {
deny all;
}

location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
Expand All @@ -49,6 +56,10 @@ http {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
fastcgi_param SERVER_NAME $http_host;
# # Uncomment if you want to use /php-fpm-status endpoint **with**
# # real request URI. It may have some side effects, that's why it's
# # commented by default
# fastcgi_param SCRIPT_NAME $request_uri;
}

error_log /proc/self/fd/2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 3
pm.max_requests = 500
pm.status_path = /php-fpm-status
clear_env = no
request_terminate_timeout = 120s
catch_workers_output = yes