mirror of
git://f0xx.org/android_cast
synced 2026-07-29 05:17:39 +03:00
snap
This commit is contained in:
@@ -47,8 +47,9 @@ curl -X POST http://127.0.0.1:8080/api/upload.php \
|
||||
## Production (nginx + PHP-FPM)
|
||||
|
||||
0. Ensure PHP modules above are installed for the FPM SAPI (not only CLI `php -m`).
|
||||
1. Copy or symlink `backend/` on the VM (e.g. `androidcast_project/backend` → `examples/crash_reporter/backend`).
|
||||
2. Use **one** `location ^~ /app/androidcast_project/crashes/` with `alias .../backend/public/` (see `nginx.vm.conf`). Do not mix `proxy_*`, `try_files`, and hardcoded `upload.php` in the same block.
|
||||
1. Deploy the git tree so this path exists on the VM (no symlinks required):
|
||||
`.../androidcast_project/android_cast/examples/crash_reporter/backend/`
|
||||
2. Point nginx `SCRIPT_FILENAME` at `.../backend/public/` (see `nginx.vm.conf`). Do not mix `proxy_*`, `try_files`, and broken alias/try_files combos in one block.
|
||||
3. Set `base_path` in `config.php` to match the URL prefix exactly.
|
||||
3. Choose DB:
|
||||
- **SQLite (default):** run `sql/schema.sqlite.sql`, set `DB_DRIVER=sqlite` in config
|
||||
|
||||
36
examples/crash_reporter/backend/nginx.apps.conf.fragment
Normal file
36
examples/crash_reporter/backend/nginx.apps.conf.fragment
Normal file
@@ -0,0 +1,36 @@
|
||||
# Paste into the listen 443 (and 80) server {} in /etc/nginx/conf.d/apps.conf
|
||||
# Replaces old per-URL blocks + any backend symlink paths.
|
||||
|
||||
location = /app/androidcast_project/crashes {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/ {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/crashes/assets/ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/assets/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/crashes/api/upload.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/upload.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/upload.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/crashes/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
# Inner VM nginx — crash reporter behind reverse proxy.
|
||||
# Inner VM nginx — crash reporter (no symlinks).
|
||||
#
|
||||
# Adjust CRASH_PUBLIC to match your deploy (symlink OK):
|
||||
# /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public
|
||||
# Canonical disk paths on Alpine BE:
|
||||
# .../androidcast_project/android_cast/examples/crash_reporter/backend/public
|
||||
#
|
||||
# URL prefix must match config.php base_path:
|
||||
# URL prefix (config.php base_path):
|
||||
# /app/androidcast_project/crashes
|
||||
|
||||
# set this once if your install supports it, else replace paths below
|
||||
# map is optional; explicit paths in each block are clearest
|
||||
#
|
||||
# Use the same location blocks on listen 80 and 443 if the FE proxy uses :80.
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name apps.f0xx.org artc0.intra.raptor.org;
|
||||
|
||||
ssl_certificate "/etc/letsencrypt/archive/apps.f0xx.org/fullchain1.pem";
|
||||
ssl_certificate_key "/etc/letsencrypt/archive/apps.f0xx.org/privkey1.pem";
|
||||
@@ -18,74 +18,41 @@ server {
|
||||
access_log /var/log/nginx/apps.intra.raptor.org.access_log main;
|
||||
error_log /var/log/nginx/apps.intra.raptor.org.error_log warn;
|
||||
|
||||
# --- adjust only this directory root on disk ---
|
||||
# CRASH_PUBLIC = .../backend/public
|
||||
|
||||
location = /app/androidcast_project/crashes {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
# Directory URL -> index.php (avoids try_files + alias bugs)
|
||||
location = /app/androidcast_project/crashes/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/crashes/index.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/crashes/api/upload.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public/api/upload.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/upload.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
# Static assets (css/js)
|
||||
location ^~ /app/androidcast_project/crashes/assets/ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public/assets/;
|
||||
}
|
||||
|
||||
# Any other .php under the prefix (if added later)
|
||||
location ~ ^/app/androidcast_project/crashes/(.+\.php)$ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/backend/public/$1;
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/ {
|
||||
return 301 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/crashes/assets/ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/assets/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/crashes/api/upload.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/upload.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/upload.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/crashes/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
# WHY "Primary script unknown":
|
||||
# - include fastcgi.conf often sets SCRIPT_FILENAME=$document_root$fastcgi_script_name
|
||||
# - That breaks under "alias" and subpath URLs -> php-fpm looks for a file that does not exist
|
||||
# - Fix: use fastcgi_params + explicit SCRIPT_FILENAME absolute path (above)
|
||||
#
|
||||
# Verify on VM:
|
||||
# ls -la /var/www/.../backend/public/index.php
|
||||
# ls -la /var/www/.../backend/public/api/upload.php
|
||||
# sudo -u nginx test -r .../index.php # user = php-fpm pool user
|
||||
|
||||
Reference in New Issue
Block a user