diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc389e..8f4a791 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Release history focused on **features, settings, default behavior, compatibility ## 0.42.2 — Generic FastCGI/CGI hosting and Apache compatibility +- **Vhost Web Server / Custom locations hotfix:** the Vhost panel no longer requires a Reverse Proxy backend for local redirects, local HTTP responses, disabled proxy routes or Web Service-only locations. Backend requirement and backend status labels use the same active-source predicate as Rust validation; enabled Reverse Proxy sources still require a backend. Regression checks cover an exact-root redirect, a local response and an active proxy exception. + +- **FastCGI profile editor UI:** wrapped dialog text and responsive profile forms; backend badge and dedicated PHP-FPM-only section. Switching to fcgiwrap/general FastCGI hides php.ini inputs and excludes them from the saved handler configuration. Local Web Service editor follows the selected handler/profile as well; generic labels are used for common limits. The FastCGI guide includes a real Nagios Core migration example without hard-coding application-specific paths. + - **Web Server `.htaccess` routing fix:** `AcceptPathInfo On/Off/Default` now controls safe FastCGI script suffix dispatch instead of being silently skipped; the original suffix (including final slash) becomes `PATH_INFO`, with `SCRIPT_FILENAME` still constrained to the real script. `RewriteBase` is parsed and applied to relative targets. Default PHP-capable Web Services try `index.php` after the static index names unless an explicit index list was set. Local `ErrorDocument` URL targets (HTTP 400–599) are rendered once for GET/HEAD with the original status preserved; other handlers and unsafe targets remain unsupported. Misconfigured `.php` front-controller rewrites produce a Web Service warning when there is no enabled `.php` FastCGI handler. Regression tests cover a realistic PHP front-controller `.htaccess`, static assets, root indexes, disabled PATH_INFO, local errors and nested base paths. `Options MultiViews`/`FollowSymlinks` continue as explicitly warned unsupported options rather than being falsely reported as supported. - **Maintenance: status-only Apache redirects:** accept `RedirectMatch 404 /\.` and other bounded 404/410 status-only Redirect/RedirectMatch forms without a target URL. Return the requested status with no `Location` header; keep path hardening and redirect validation. Add a regression fixture with a typical PHP front-controller `.htaccess` file, including unsupported non-security directives in non-strict mode. diff --git a/SHA256SUMS b/SHA256SUMS index c505c75..7a42325 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -2,7 +2,7 @@ 4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example 0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore 3c4638dc086333b8383c5bc77fe967b790075439f5e7a8257e5dd0dd4cf4233b AGENTS.md -47dff846d956b68ef225d0c6332ea9ed4b4248db2f26aef9a615c510c3d24cb9 CHANGELOG.md +e9c7db0ca1e5d13bf98e6a9a590ec875d6bb3bc29a92cf84915e2cd61e17881a CHANGELOG.md c28d825120a878684b511b1a6a4f372aced5098ed7b9bec8b318c4ec3fb1cbf4 Cargo.lock 3ac98730af5caa39f81d28f4a4f7f14710fbb53d625794dd5704e65afebe4d8e Cargo.toml 788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile @@ -45,10 +45,10 @@ bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md 51d34823d139ff3b0b8e1cf1a31850746be5ed7da847a2cca51be36fd5f7733a docs/CACHE_TEMPLATE_LIBRARY.md 31285f000cf725d018a926023fe608fec983b959053f7a55e0954b962a8bc20c docs/CERTIFICATES.md 81df6715e2f07617fe0bbb0960c4d5bdac28cf665ce7297fa3768118e6ab28ba docs/CONFIGURATION.md -966a1c49274c45568cf2b34158900524471f50d796d227a02db49c57941cc808 docs/CUSTOM_LOCATIONS.md +2cede323fe2767100258b5e1d3e3a8b362e2a91acf2b0ee61090c4a2db97d952 docs/CUSTOM_LOCATIONS.md 16d4510e38d43c3bbde9b7dab7af3aeb0cb837dc2f1956cfaad7a9a11bea3bfc docs/DASHBOARD.md 53cb0ce7db5ce25e4c2381de3a6e875d212deeed08861da63050de6c51a442bd docs/DOCKER_DISCOVERY.md -6a8ccaa0220acce78e596360998752e859fc53984410e8cc5f4c33cc92317d36 docs/FASTCGI.md +3e729724030fd38d2d77272fddbb6509b7cd971c6bf0e9e3ef234ad69e342156 docs/FASTCGI.md d86b3d705d0cc46182c355deeb3d6e88bcf81d031560aad0eb4cc3dee3b38ec8 docs/FEATURES.md f7bb59821e0d6c45ae2a1789086fd9dab33d91c0ceae784ae68f64bd13b5f496 docs/HEADLESS.md bce732d845c23ad677ae811e7529b9322ab41d04ca808e04087d0f76bccd9309 docs/INSTALL.md @@ -70,7 +70,7 @@ df83d07d7186a5eea60d206dee3cb62b7f6505a066d84141fc53130e2f29760b docs/TROUBLESH 53005e1eeb460c960794e2b2f1ab7cfc472c510b14bea3193d25f5f81ba7a1e4 docs/VCL.md 4a5534b628c18f4e83c67c6136b60969c884391fbe55cc6bd4f2354711d8ffb7 docs/VCL_SUPPORT_MATRIX.md 382e084a1f9e35627ccb43eaf451c18fb6d0cc752397c2178108d71de592a931 docs/VCL_TRAFFIC_COOKBOOK.md -181444ea2c28171ed89ead25dcfc60ee6bd05f7b01c1a49d8248a307dc9be7a4 docs/VHOSTS.md +a382a9d4b0acb04f1d0a1049f14d30e5e21e1b697012d465e8bfc5e8281a3894 docs/VHOSTS.md bccc92cf4d751c05a4a315076739582fe0f307b54fd4f26273fa4a3caaa1a23d docs/WEB_SERVER.md 42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png @@ -137,8 +137,8 @@ e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/r 3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh 3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md -a899c29ec4d21c6feb436567626b82a0c97c8b494b4976a4e93caed74b37b144 langs/en_US.json -eb1aa36fdb83b224e64a47ac13816a63811069beec22751efea6a8632444d1c1 langs/pl_pl.json +a97c2e145a407b016b47bf361741f3c6248499dde74372587025f1e0d04bd8bc langs/en_US.json +eae13817e05269807ed19b9e1cb78cdda7e3e65ae43a00c84e787d868e30e175 langs/pl_pl.json 38773ed251a8c24af353f4744e498ae2bc7d4151df7927e942c4ac223f6008e1 make_zip.py e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql 20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql @@ -177,6 +177,7 @@ be88ca2163d84913e0d9ee97f95d3217d4a92fc7df122927336deae5f8fcfb3d scripts/prefli 2a95ee85848d347b419dcc2c3a1c65b62d491081a554f5fb50623770a5c15b80 scripts/runtime/acme_provider.py e69813fb1d3a4cdcfb7243964cc323fc21a603087bf2e84188fa42b9d3cee4b5 scripts/runtime/acme_rfc2136.py 91c883cfdce94c8c22c98749f611317f538a112d29be4f3fb1fa460b8f29ceaa scripts/start_stream_backends.sh +01f0df9510163760d41d2e475b5fd00d1084cb2b2aff835f2abdef728b32ad02 scripts/test_vhost_source.js 22e880e98c7b9d700c7a4c02b9b1d543e5dbd1f4ecdca42813a1083165b32a19 scripts/version.py 78efae6c43732c0f5527d467bf07d1f890da361925416c89b58bc449d852fc2b src/acl.rs f097cce1f831e01b68688eb60c1b6393413131e6543c4627f3cedd9ef706193b src/acl/dynamic/mod.rs @@ -224,7 +225,7 @@ ea202c67d9acb7614046f153beecdff10d5822b3d5627eaf2ebda33954b36474 src/admin/pref 62ecbae5dee00aeeca3eb806e2605372471dfab971cde8f66f11e711df8fcea1 src/admin/public/mod.rs 7a00e4ab943f74d2b1bdcbfab7f9cd3f584e9f59536b4aca6c4c31f5f5508d12 src/admin/public/tests.rs 6930b4f4b45257772b321b20a9becdf9bc4610274852948ba38c2d0cdf02dfaf src/admin/refresh_preferences.rs -3d210447933638b507e70692bcbacf7bb1bb1a62f9bf3b3300ee0dc5c7c3e20e src/admin/router.rs +fb612856189d447f6f2dc88b5a854e51db7f06c518bba4a1432ec6f0d0f9c4f5 src/admin/router.rs fba52102e77ca8871a42f97c91be8f10a9aa4f997868652d550fff3fbd41b66e src/admin/session.rs 38f53c52c2e3bc49b5ad4254c657d282cf4ca7c8c11c6a79cc1d7a2086f017de src/admin/status.rs bac2116e9a7d5f19a112565e1483787ff6102f489bed0cb3b0b3e2102ddd3edb src/admin/status_live.rs @@ -267,7 +268,7 @@ ba22ff211f408052aee0aa75a5a52734b1c257247e7112972aff75a9646faf22 src/admin/web/ 433f5ccf0a4df1c4452f746f7b2f351f6712ee73873cb07204638c205e4f2c88 src/admin/web/cache-rules.js 6288b0a8228d828ac2e2535ace2d1aefd1c04011e789eb97f7279129874ac35c src/admin/web/certificate-api.js c2912a5e218896177776d4c5920e240092a3de66f9a4b95c1631796771e0ce3c src/admin/web/css/00-tokens.css -79f62673d36fd7ddc2b79729bcfc2b80d290712e38d3b6f18fca4573487c6959 src/admin/web/css/10-base.css +7b74fd7837ed42a9334dce8e21bdb03fa00a90f0e396e239ac1fc1dbb71f06b8 src/admin/web/css/10-base.css 9cd9b62ff8cfba47cb180e29ea5f69b8e97c7817dfcfddcb55fc4e08d11a7184 src/admin/web/css/20-shell.css 5af483ff7937ff245d8718179dc6001716d2b279f6ce935f5aa0c9fcfa370ab8 src/admin/web/css/30-overview.css 2763ff8969567cbd001ba4b5d5b669aea7aec347088ffe7c2b164b82396755d5 src/admin/web/css/40-editors.css @@ -302,7 +303,7 @@ e6c4d91d1542d0a5b47bb8736f9539d43a6713df5a473b635519d5b7eac2eb9c src/admin/web/ 0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg e0f0b302092ced1c84ef7e99864984444f0e9d4e3b7d85e74d3507d566952a7f src/admin/web/file-logs.js 85f54ce519140a38e31fb1b3d5974585748d7162f0499aa63703c1db56334b2c src/admin/web/host404.js -e41461c7acd92b83bc6074ac97b6764847a3f7985c03a3120531e98f9db8cfe7 src/admin/web/index.html +168edd2122464c5f1004e870f23933c4ded14eb6106dd92cc1e36c2567f6f9c5 src/admin/web/index.html be9999a001c59630963d60539e860b59999dcf74c5ff0087b12a6fb69b4e7bd2 src/admin/web/integrations.js 7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html @@ -323,15 +324,16 @@ bb16f579d1de89c565c95adb496def4051553f17d928d2128f4bf08ca66e5ca1 src/admin/web/ 675ea169d4cc55fda5e291af536338b882bede1eaa6c9d5cc7dfde0779c7c4d1 src/admin/web/transform-panel.js c30373b0f2dc5672f88bc6fad0ffd5f6d85496d75da8fae83c6aa306e4e0f676 src/admin/web/vhosts/balancing.js 2035bbee6d91aa124fecc0de4fb97c418b7cdba7fb06a3dde0885b929bc9ffff src/admin/web/vhosts/core.js -3865d62d562f1aed0405bc4a392c2c977ecbe8a330f344bb501a70edb028ea20 src/admin/web/vhosts/editor.js +1920fd45cb922ffdea5401f998f1307fb021174fefa9a1a35e4659960b2c6b2c src/admin/web/vhosts/editor.js f082588c35d981fc689542d4c12a7614638279335220d587fdee5d3fff822e80 src/admin/web/vhosts/headers-tab.js 3776f72d7051af86ac5fbdd4581040dd88a424c0c6cde789301b032b159094d8 src/admin/web/vhosts/health.js b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/vhosts/protocol.js 8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js -fafb4f9e8f123c93a5277052a375a9d2dd8f986322abd17f2206c16f0c37df06 src/admin/web/vhosts/render.js +76f603802ad3e19005de583fcaac24b61b5bc79317894fca2fd9fd974b5f33fd src/admin/web/vhosts/render.js 90684f1bfb0e079438654e1f8c5b9ee1b4f74e49126a82c88768f3ae209a1875 src/admin/web/vhosts/routing.js -b78d058deabc6a238560222bfdf131df3812407f73bdd000279df273b5d5dfc9 src/admin/web/web-server-profiles.js -c373850916ed66250583ebafa960e5c2a22ff3d0c63610ec61a1d16810bf5b17 src/admin/web/web-server.js +7be5a5fed5480b431d2eece59271c2567dd48592b9d7e65fdb30b4a28f58ce3a src/admin/web/vhosts/source.js +b6f06f16e4035d856f13a633e51fd6bd1de23b872fc1b47726557554ef2a8a42 src/admin/web/web-server-profiles.js +31cc5bc08cb1d34cfbed206277eeed0f4dd09333de0ff0537bd67b404f1184de src/admin/web/web-server.js 36f11beed56711640bb56bb6f452bf76dec2ce4be6a57e8abc19560af477c870 src/alerts.rs 2d40c2cb32d7365df0c9cd6c8cb6f0483c7a799786c648f4836a0d9740c6c5ef src/auth/files/mod.rs b2f948bcc3dbd24952c7b1b02d41d06757f49f0c38a78caf51f8f8a687d8480d src/auth/files/tests.rs @@ -625,7 +627,7 @@ f8b3f8e45306b13ee925f5cb54f8e2de1934314e2c590f14be7ca3814438f4af src/vhost/cond 846707452ccf10962f1763be66b8f56c050b0398b48968015fb799dac289c0d6 src/vhost/error_fallback.rs a7b789d92cda754ba74f6b2c8de0693626b311112cf50b6a73fbe3f52dbeade5 src/vhost/model.rs fc8af7342a3b147921e9040116af5dfe680b3df910db2416ada18198bbeea7df src/vhost/redirect.rs -5a5768740e9a486436f6bb4e285ed99fd445cabbc21f317a47dc32c1f7091385 src/vhost/tests.rs +c8722700c4e42b5daa212e70a4c56938f41c1ada8c541cb6b614a2d496369741 src/vhost/tests.rs 34ffb202075c9fa720d2a23c6d901471655befe583a6335d778391d467cc8186 src/vhost/validation.rs 8d1eff4b24f01d137414ef5419f75dd281879228adb70409645b11b3c78c20e9 src/web_server/config.rs 77e030e44dfb3019765927a42626f6154df423b74f816e6432dec1df14572e65 src/web_server/config/compile.rs diff --git a/docs/CUSTOM_LOCATIONS.md b/docs/CUSTOM_LOCATIONS.md index 6eb7192..4730d3e 100644 --- a/docs/CUSTOM_LOCATIONS.md +++ b/docs/CUSTOM_LOCATIONS.md @@ -75,6 +75,8 @@ Example — beta testers by header, office network with a staff cookie for the w - **Local response:** return a chosen `200–599` status, content type and body without connecting to an origin. `HEAD`, `204` and `304` do not return a body. - **Redirect:** issue `301`, `302`, `303`, `307` or `308` to a valid absolute HTTP(S) target. Query preservation is configurable. Redirect rewrite expressions may reference regex captures. +**Web Service Vhosts do not need a Reverse Proxy backend** just to use a Redirect or Local response location. Only the main Reverse Proxy source or an enabled Proxy location requires a backend pool. To redirect only `/` to an application prefix, choose **Exact** match for `/` (not Prefix `/`, which also matches application subpaths), **Redirect**, and a code such as **302** with an absolute destination URL. + ### Path rewriting `preserve` forwards the original path, `strip_prefix` removes the matched prefix, `replace_prefix` substitutes a new normalized prefix and `regex` rewrites using captures such as `$1` or `${name}`. Queries remain intact unless a redirect explicitly changes handling. Public cache keys are based on the client-facing URL, not an internal rewritten backend path. diff --git a/docs/FASTCGI.md b/docs/FASTCGI.md index 2c9e76a..2efff58 100644 --- a/docs/FASTCGI.md +++ b/docs/FASTCGI.md @@ -68,6 +68,50 @@ The exact and regex rules use Rust's `regex` syntax, not PCRE look-arounds. `str **Protect access:** Enable **Vhost Basic Auth** if the application needs it, using the existing RustProxy credential settings (or another supported authentication provider; only verified Vhost Basic Auth currently maps to `REMOTE_USER`). Avoid publishing admin/CGI directories as static paths. `deny all` for hidden files can be implemented with Vhost ACL/location rules and optional `.htaccess` security rules. Server-level HTTPS, certificate renewal, IPv6 listeners and access/error logging are configured through RustProxy listeners/Vhosts/logs, not inside FastCGI settings. +## Nagios Core: PHP pages and CGI checks under `/nagios/` + +The following is a **site-specific example** of the generic three-service arrangement above. It replaces common Angie/Nginx rules for a Nagios Core UI; the FastCGI engine does not contain any Nagios-specific code. Adjust paths and socket names to your installation. + +**Prerequisites:** Nagios static/PHP files are under `/usr/local/nagios/share/`, executable CGI files under `/usr/local/nagios/sbin/`, PHP-FPM is listening on `unix:/run/php/php8.3-fpm.sock` and fcgiwrap on `unix:/run/fcgiwrap.socket`. Verify that the RustProxy operating-system account can read the site, traverse both document roots and connect to both Unix sockets. Do not change socket permissions to world-writable as a workaround. CGI programs may require Nagios-specific OS users/groups to read status data. + +1. Under **Web Server → FastCGI profiles**, create `nagios-php` with **handler `php_fpm`**, enabled, endpoint `unix:/run/php/php8.3-fpm.sock`, executable extensions `php` and public `SCRIPT_NAME` prefix `/nagios`. Leave `PHP_VALUE` / `PHP_ADMIN_VALUE` at defaults unless the PHP-FPM pool genuinely needs overrides. +2. Create `nagios-cgi` with **handler `fcgiwrap`**, enabled, endpoint `unix:/run/fcgiwrap.socket`, executable extensions `cgi`, public `SCRIPT_NAME` prefix `/nagios/cgi-bin`, and `PATH_INFO` disabled unless a specific script uses it. This handler does **not** use `PHP_VALUE` or `PHP_ADMIN_VALUE`. +3. Create these **Web Services** (the profile and service are separate objects): + + | Web Service ID | Document root | Shared profile | Index files | `try_files` | + |---|---|---|---|---| + | `nagios-web` | `/usr/local/nagios/share` | `nagios-php` | `index.php`, `index.html`, `index.htm` | `$uri`, `$uri/`, `=404` | + | `nagios-cgi-scripts` | `/usr/local/nagios/sbin` | `nagios-cgi` | none | `$uri`, `=404` | + | `nagios-empty` | An existing, empty directory such as `/srv/rustproxy/empty` | disabled | none | `=404` | + + Keep `symlink_policy=deny` for executable Web Services. The empty default service avoids accidentally exposing the same files outside `/nagios/`. +4. Create a **Vhost** for `n.linuxiarz.pl` on HTTP and HTTPS listeners. Use `nagios-empty` as the default Web Server source; configure a TLS certificate (RustProxy ACME or imported), HTTPS redirection and HTTP/2 as required. Configure Vhost **Basic Auth** with users managed by RustProxy. The Angie `auth_basic_user_file` directive is **not** read automatically; verified Vhost Basic Auth is what supplies `REMOTE_USER` / `AUTH_USER` to CGI. Only enable `pass_authorization` when a script requires `HTTP_AUTHORIZATION`. +5. In **Vhost → Custom locations**, add these entries in the order shown. Choose action **Web Server** for the two service routes, **Redirect** for the first two, and **Local response** for the hidden-file deny. Enter full HTTPS URLs for redirect targets (the Custom location redirect editor requires an absolute URL). + + | Match | Pattern | Action / target | Path rewrite | + |---|---|---|---| + | `exact` | `/` | `302` to `https://n.linuxiarz.pl/nagios/` | — | + | `exact` | `/nagios` | `301` to `https://n.linuxiarz.pl/nagios/` | — | + | `regex` | `^/nagios/(?:[^/]+/)*\.[^/]+(?:/|$)` | Local response `403`, no content | — | + | `regex` | `^/nagios/cgi-bin/(.*\.cgi)$` | Web Service `nagios-cgi-scripts` | `regex` → `/$1` | + | `prefix` | `/nagios/` | Web Service `nagios-web` | `strip_prefix` | + + The hidden-file rule must be tested before the CGI regex so a dot-prefixed executable cannot bypass it. An additional PHP-specific regex is **unnecessary** here: `nagios-web` serves static files and dispatches `.php` to its PHP-FPM profile. If you need different PHP socket/root rules, use an additional PHP-specific Web Service and a regex Custom location instead. + +**Expected mapping:** `GET /nagios/` finds `/usr/local/nagios/share/index.php` (or the configured existing index), `GET /nagios/stylesheets/style.css` stays static, and `GET /nagios/cgi-bin/status.cgi?host=all` selects the CGI Web Service. The latter sends `SCRIPT_FILENAME=/usr/local/nagios/sbin/status.cgi`, `SCRIPT_NAME=/nagios/cgi-bin/status.cgi`, original `REQUEST_URI`, `QUERY_STRING=host=all` and `REMOTE_USER` when RustProxy Basic Auth has successfully authenticated the user. Do **not** add `$1` expressions into Custom FastCGI parameters: core script and identity fields are calculated safely by RustProxy. + +Verify after applying the configuration: + +```bash +curl -I http://n.linuxiarz.pl/ +curl -Ik https://n.linuxiarz.pl/nagios +curl -ik -u operator https://n.linuxiarz.pl/nagios/ +curl -ik -u operator 'https://n.linuxiarz.pl/nagios/cgi-bin/status.cgi?host=all' +curl -Ik https://n.linuxiarz.pl/nagios/.htaccess +``` + +Expect redirects for `/` and `/nagios`, a Basic Auth challenge without credentials, a PHP/static page for `/nagios/`, FastCGI output (not CGI source code) for the CGI URL, and `403` for dotfiles (a Basic Auth challenge may happen first). A `502` suggests a missing backend/socket or bad socket permissions; a `403` can also mean the script is inaccessible/non-executable, and `404` can mean a wrong rewrite or document root. The exact Nagios page may require additional stylesheets/aliases or Nagios-specific CGI environment and permissions. Test these against a real installed Nagios, not only a mock FastCGI server. + ## Migrating from Nginx / Angie | Original directive | RustProxy equivalent | diff --git a/docs/VHOSTS.md b/docs/VHOSTS.md index dccd5c4..c925209 100644 --- a/docs/VHOSTS.md +++ b/docs/VHOSTS.md @@ -63,7 +63,7 @@ Under **Vhosts → Edit → Security → Country access**, choose `Off`, `Block` - **Reverse Proxy:** one Vhost has a backend pool. Each member has a configured URL, ID, enabled flag, weight, optional backup/drain state, health settings and capacity limits. - **Web Server:** Vhost references a Web Service by ID. Its document root, directory handling, PHP options and static-file headers remain configured under **Web Server**. -- **Custom locations:** can override selected URL paths and use the default pool, a backend group with its own balancing, a pinned backend, a different Web Service, a redirect or a local response. Unmatched paths still use the main source. Locations and whole-host rules can also require conditions on headers, cookies, query parameters, method, client IP, host or country — see [Request conditions](CUSTOM_LOCATIONS.md#request-conditions-routing-by-header-cookie-ip). +- **Custom locations:** can override selected URL paths and use the default pool, a backend group with its own balancing, a pinned backend, a different Web Service, a redirect or a local response. Unmatched paths still use the main source. Locations and whole-host rules can also require conditions on headers, cookies, query parameters, method, client IP, host or country — see [Request conditions](CUSTOM_LOCATIONS.md#request-conditions-routing-by-header-cookie-ip). A Web Server Vhost needs **no proxy backend** when its custom locations are solely local redirects, responses or other Web Services; an enabled Reverse Proxy location still needs a backend. Sample documents in `examples/vhosts-private.json` and `examples/vhosts-balanced.json` illustrate JSON formats, but their IP addresses, certificates and health endpoints are examples only. diff --git a/langs/en_US.json b/langs/en_US.json index c13efbc..dfa6d49 100644 --- a/langs/en_US.json +++ b/langs/en_US.json @@ -9,10 +9,10 @@ "webServiceStaticDeliverySection": "Static file delivery", "webServiceDynamicCompressionSection": "Dynamic compression", "webServiceSidecarsSection": "Precompressed assets", - "webServicePhpSourceSection": "PHP-FPM source and endpoint", + "webServicePhpSourceSection": "FastCGI configuration source and endpoint", "webServicePhpRequestSection": "Request handling", "webServicePhpLimitsSection": "Timeouts and capacity", - "webServicePhpOverridesSection": "FastCGI and php.ini overrides", + "webServicePhpOverridesSection": "FastCGI parameters and PHP-FPM options", "hostIdentitySection": "Host and domains", "streamBackendConnectionSection": "Backend and capacity", "streamBackendHealthSection": "Health checks", @@ -2123,9 +2123,9 @@ "webServicePhpConnectTimeout": "Connect timeout (ms)", "webServicePhpRequestTimeout": "Total FastCGI request timeout (ms)", "webServicePhpConcurrency": "Max concurrent PHP requests", - "webServicePhpBodyLimit": "PHP request body limit (bytes, 0 = unlimited)", + "webServicePhpBodyLimit": "FastCGI request body limit (bytes, 0 = unlimited)", "webServicePhpHeaderLimit": "Max FastCGI response header bytes", - "webServicePhpStderrLimit": "Max PHP-FPM stderr log bytes", + "webServicePhpStderrLimit": "Max FastCGI STDERR log bytes", "webServicePhpCustomParams": "Custom FastCGI parameters", "webServicePhpCustomParamsHelp": "One NAME = value per line, e.g. APP_ENV = production. Names: A-Z, digits, underscores; no HTTP_*, PHP_VALUE, PHP_ADMIN_VALUE or core CGI parameters.", "webServicePhpCustomParamsInvalid": "Custom FastCGI parameters must use one unique NAME = value entry per line.", @@ -2621,13 +2621,14 @@ "locationErrorFallbackStatuses": "Intercepted status codes", "locationErrorFallbackHelp": "Optional Nginx-style error fallback. Target an enabled internal location by ID. Supported statuses: 403, 404, 500, 502, 503, 504.", "webServicePhpPathInfo": "Enable FastCGI PATH_INFO splitting", - "phpProfileSelect": "PHP-FPM configuration", + "phpProfileSelect": "FastCGI configuration source", "phpProfileLocal": "Local configuration", "phpProfileHelp": "Select a shared FastCGI profile or configure this Web Service directly. Shared edits affect all attached services.", "phpProfileManage": "Manage FastCGI profiles", "phpProfileToolbar": "FastCGI profiles", "phpProfileTitle": "Shared FastCGI profiles", - "phpProfileDescription": "Expand a profile to edit it; save applies immediately to every attached Web Service.", + "phpProfileDescription": "Expand a profile to edit its settings. Saving updates every attached Web Service immediately. php.ini fields are available only for PHP-FPM.", + "phpProfilePhpOnlySection": "PHP-FPM only: php.ini overrides", "phpProfileAdd": "Add profile", "phpProfileNew": "New PHP-FPM profile", "phpProfileId": "Profile ID", @@ -2648,13 +2649,13 @@ "cacheOnlyHits": "Show RustProxy cache diagnostics only on HIT (retain origin headers)", "cacheDetailedStatus": "X-Cache shows STALE and REVALIDATED instead of HIT", "phpHintEnabled": "Enable execution of configured script extensions through an already-running PHP-FPM, CGI runner, or FastCGI responder. The backend must be reachable.", - "phpHintPathInfo": "Split /static.php/skins/file.css into SCRIPT_FILENAME=static.php and PATH_INFO=/skins/file.css. Useful for Roundcube; usually unnecessary for WordPress. Off by default.", + "phpHintPathInfo": "Split /script.cgi/extra into SCRIPT_FILENAME=script.cgi and PATH_INFO=/extra (also available for PHP). Enable only if your application uses suffix paths. Off by default.", "phpHintPassAuthorization": "Pass the incoming Authorization header as HTTP_AUTHORIZATION to PHP (API/Bearer/Basic authentication). Disable if not needed.", "phpHintExtensions": "Only these extensions are executed by the selected backend. Use php for PHP-FPM and cgi or fcgi for compatible script handlers. Unhandled script extensions are not served as static code.", "phpHintConnectTimeout": "PHP-FPM socket connection timeout in milliseconds: 1000 = 1 second. Range: 50–60000.", "phpHintRequestTimeout": "Timeout for the complete FastCGI request in milliseconds: 30000 = 30 seconds. Range: 100–3600000.", "phpHintConcurrency": "Maximum concurrent PHP requests per service: e.g. 64. Exhaustion returns 503. Range: 1–4096.", - "phpHintBodyLimit": "Request-body limit in bytes: 67108864 = 64 MiB. 0 means no RustProxy-side limit. PHP post_max_size is separate.", + "phpHintBodyLimit": "Request-body limit in bytes: 67108864 = 64 MiB. 0 means no RustProxy-side limit. PHP post_max_size applies separately.", "phpHintHeaderLimit": "Maximum FastCGI response header length in bytes: 65536 = 64 KiB. Range: 4096–1048576.", "phpHintStderrLimit": "Maximum PHP-FPM STDERR bytes logged per request: e.g. 4096. 0 disables stderr capture (max 65536).", "phpHintAdminValues": "Trusted administrative INI settings, e.g. open_basedir = /var/www/webmail/:/tmp/. Use a dedicated PHP-FPM pool/socket to prevent cross-vhost INI leakage.", diff --git a/langs/pl_pl.json b/langs/pl_pl.json index 09f0356..9f81c3b 100644 --- a/langs/pl_pl.json +++ b/langs/pl_pl.json @@ -9,10 +9,10 @@ "webServiceStaticDeliverySection": "Dostarczanie plików statycznych", "webServiceDynamicCompressionSection": "Kompresja dynamiczna", "webServiceSidecarsSection": "Gotowe pliki skompresowane", - "webServicePhpSourceSection": "Źródło konfiguracji i połączenie PHP-FPM", + "webServicePhpSourceSection": "Źródło konfiguracji i połączenie FastCGI", "webServicePhpRequestSection": "Obsługa żądań", "webServicePhpLimitsSection": "Limity czasu i obciążenia", - "webServicePhpOverridesSection": "Parametry FastCGI i ustawienia php.ini", + "webServicePhpOverridesSection": "Parametry FastCGI i opcje PHP-FPM", "hostIdentitySection": "Host i domeny", "streamBackendConnectionSection": "Backend i obciążenie", "streamBackendHealthSection": "Kontrola dostępności", @@ -2123,9 +2123,9 @@ "webServicePhpConnectTimeout": "Timeout połączenia (ms)", "webServicePhpRequestTimeout": "Łączny timeout żądania FastCGI (ms)", "webServicePhpConcurrency": "Maks. równoległych żądań PHP", - "webServicePhpBodyLimit": "Limit body żądania PHP (bajty, 0 = bez limitu)", + "webServicePhpBodyLimit": "Limit treści żądania FastCGI (bajty, 0 = bez limitu)", "webServicePhpHeaderLimit": "Maks. bajtów nagłówków odpowiedzi FastCGI", - "webServicePhpStderrLimit": "Maks. bajtów stderr PHP-FPM w logu", + "webServicePhpStderrLimit": "Maks. bajtów STDERR FastCGI w logu", "webServicePhpCustomParams": "Własne parametry FastCGI", "webServicePhpCustomParamsHelp": "Jedna linia NAME = wartość, np. APP_ENV = production. Nazwy: A-Z, cyfry i podkreślenia; bez HTTP_*, PHP_VALUE, PHP_ADMIN_VALUE i podstawowych parametrów CGI.", "webServicePhpCustomParamsInvalid": "Własne parametry FastCGI muszą mieć unikalny format NAZWA = wartość, po jednym wpisie na linię.", @@ -2621,13 +2621,14 @@ "locationErrorFallbackStatuses": "Przechwytywane kody statusu", "locationErrorFallbackHelp": "Opcjonalny fallback błędów w stylu Nginx. Wskaż ID włączonej lokalizacji wewnętrznej. Obsługiwane statusy: 403, 404, 500, 502, 503, 504.", "webServicePhpPathInfo": "Włącz dzielenie FastCGI PATH_INFO", - "phpProfileSelect": "Konfiguracja PHP-FPM", + "phpProfileSelect": "Źródło konfiguracji FastCGI", "phpProfileLocal": "Konfiguracja lokalna", "phpProfileHelp": "Wybierz współdzielony profil FastCGI lub skonfiguruj usługę lokalnie. Zmiany profilu dotyczą wszystkich przypiętych usług.", "phpProfileManage": "Zarządzaj profilami FastCGI", "phpProfileToolbar": "Profile FastCGI", "phpProfileTitle": "Wspólne profile FastCGI", - "phpProfileDescription": "Rozwiń profil, aby go zmienić. Zapis od razu aktualizuje wszystkie przypięte serwery WWW.", + "phpProfileDescription": "Rozwiń profil, aby zmienić ustawienia. Zapis od razu aktualizuje wszystkie powiązane Web Service. Ustawienia php.ini są dostępne tylko dla PHP-FPM.", + "phpProfilePhpOnlySection": "Tylko PHP-FPM: ustawienia php.ini", "phpProfileAdd": "Dodaj profil", "phpProfileNew": "Nowy profil PHP-FPM", "phpProfileId": "ID profilu", @@ -2648,13 +2649,13 @@ "cacheOnlyHits": "Pokazuj naglowki RustProxy tylko dla HIT (zachowaj naglowki backendu)", "cacheDetailedStatus": "X-Cache pokazuje STALE i REVALIDATED zamiast HIT", "phpHintEnabled": "Włącz wykonywanie wybranych rozszerzeń przez już uruchomiony PHP-FPM, wykonawcę CGI lub serwer FastCGI. Backend musi być dostępny.", - "phpHintPathInfo": "Rozdziela /static.php/skins/file.css na SCRIPT_FILENAME=static.php i PATH_INFO=/skins/file.css. Potrzebne np. w Roundcube; zwykle zbędne w WordPressie. Domyślnie wyłączone.", + "phpHintPathInfo": "Dzieli URL /script.cgi/extra na SCRIPT_FILENAME=script.cgi i PATH_INFO=/extra (również dla PHP). Włącz tylko, jeśli aplikacja wymaga takiej ścieżki. Domyślnie wyłączone.", "phpHintPassAuthorization": "Przekazuje nagłówek Authorization do PHP jako HTTP_AUTHORIZATION (np. API/Bearer/Basic). Wyłącz, gdy aplikacja go nie używa.", "phpHintExtensions": "Tylko te rozszerzenia uruchamia wybrany backend. Dla PHP-FPM użyj php, dla CGI/FastCGI np. cgi lub fcgi. Pozostały kod wykonywalny nie jest serwowany jako plik statyczny.", "phpHintConnectTimeout": "Limit łączenia z gniazdem PHP-FPM w milisekundach: 1000 = 1 sekunda. Zakres: 50–60000.", "phpHintRequestTimeout": "Limit całego żądania FastCGI w milisekundach: 30000 = 30 sekund. Zakres: 100–3600000.", "phpHintConcurrency": "Maksymalna liczba równoległych żądań PHP na usługę, np. 64. Przekroczenie zwraca 503. Zakres: 1–4096.", - "phpHintBodyLimit": "Limit treści żądania w bajtach: 67108864 = 64 MiB. 0 = bez limitu po stronie RustProxy. PHP post_max_size jest osobny.", + "phpHintBodyLimit": "Limit treści żądania w bajtach: 67108864 = 64 MiB. 0 = bez limitu po stronie RustProxy. W PHP osobno obowiązuje post_max_size.", "phpHintHeaderLimit": "Maksymalny rozmiar nagłówków odpowiedzi FastCGI w bajtach: 65536 = 64 KiB. Zakres: 4096–1048576.", "phpHintStderrLimit": "Maksymalna liczba bajtów STDERR PHP-FPM w logu na żądanie, np. 4096. 0 wyłącza przechwytywanie (maks. 65536).", "phpHintAdminValues": "Administracyjne ustawienia INI, np. open_basedir = /var/www/webmail/:/tmp/. Aby zapobiec przeciekaniu ustawień między vhostami, stosuj osobne pule i gniazda PHP-FPM.", diff --git a/src/admin/router.rs b/src/admin/router.rs index 5f4604f..d8b9949 100644 --- a/src/admin/router.rs +++ b/src/admin/router.rs @@ -123,6 +123,7 @@ fn admin_vhosts_javascript() -> &'static str { static ASSET: std::sync::LazyLock = std::sync::LazyLock::new(|| { [ "(() => {", + include_str!("web/vhosts/source.js"), include_str!("web/vhosts/core.js"), include_str!("web/vhosts/protocol.js"), include_str!("web/vhosts/health.js"), diff --git a/src/admin/web/css/10-base.css b/src/admin/web/css/10-base.css index a6208fd..377c1bc 100644 --- a/src/admin/web/css/10-base.css +++ b/src/admin/web/css/10-base.css @@ -1667,4 +1667,101 @@ html[data-interface-icons="true"] :is(button, a, summary)>svg.ui-icon { flex: 0 0 auto; max-width: none; overflow: visible; -} \ No newline at end of file +} +/* Shared FastCGI profiles: keep the help text and controls inside the dialog, + including at high UI zoom and with long translated labels. */ +#php-fpm-profiles-dialog { + width: calc(min(860px, 100vw - 24px) / var(--ui-scale, 1)); +} + +#php-fpm-profiles-dialog .location-help-content { + min-width: 0; + overflow-wrap: anywhere; +} + +#php-fpm-profiles-dialog .php-profiles-description { + display: block; + max-width: 100%; + margin: 0 0 12px; + white-space: normal; + overflow-wrap: anywhere; + line-height: 1.55; +} + +#php-fpm-profiles-list { + display: grid; + min-width: 0; + gap: 8px; + margin: 0 0 12px; +} + +#php-fpm-profiles-list > .fastcgi-profile-card { + min-width: 0; + margin: 0; +} + +#php-fpm-profiles-list .fastcgi-profile-summary { + cursor: pointer; + padding: 4px 6px; + overflow-wrap: anywhere; +} + +#php-fpm-profiles-list .fastcgi-profile-title { + font-weight: 600; +} + +#php-fpm-profiles-list .fastcgi-profile-handler { + display: inline-block; + margin-inline-start: 12px; + padding: 1px 6px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-control, 3px); + color: var(--muted); + font-size: 10px; +} + +#php-fpm-profiles-list details[open] > .fastcgi-profile-summary { + margin-bottom: 12px; + border-bottom: 1px solid var(--line); +} + +#php-fpm-profiles-list .fastcgi-profile-editor { + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + width: 100%; + min-width: 0; +} + +#php-fpm-profiles-list .fastcgi-profile-editor > label { + display: grid; + gap: 4px; + min-width: 0; + grid-row: auto; +} + +#php-fpm-profiles-list .fastcgi-profile-editor > label > :is(input, select, textarea) { + width: 100%; + max-width: 100%; + min-width: 0; +} + +#php-fpm-profiles-list .fastcgi-profile-editor .fastcgi-profile-php-heading { + padding-top: 6px; + border-top: 1px solid var(--line); +} + +#php-fpm-profiles-list .fastcgi-profile-editor .fastcgi-profile-php-heading strong { + font-size: 12px; +} + +.fastcgi-php-only-local[hidden], +#php-fpm-profiles-list .fastcgi-php-only[hidden], +#php-fpm-profiles-list .fastcgi-profile-php-heading[hidden] { + display: none !important; +} + +@media (max-width: 650px) { + #php-fpm-profiles-list .fastcgi-profile-editor { + grid-template-columns: minmax(0, 1fr); + } +} diff --git a/src/admin/web/index.html b/src/admin/web/index.html index 1e2a53a..e3a2062 100644 --- a/src/admin/web/index.html +++ b/src/admin/web/index.html @@ -4989,9 +4989,9 @@ curl -sS -D - -o /dev/null \