I am stuck with my nginx (nginx/1.14.2) configuration for a php (php-7.4) App that would normally send error notifications to sentry.
I moved a php application from an apache to nginx server and now my sentry errors are not reported anymore ... what did I do wrong?
here is my nginx config:
server {
root /var/www/services/some-sesrvice;
index index.php;
server_name *****.com;
access_log /var/log/nginx/some-service.access.log;
error_log /var/log/nginx/some-service.error.log;
location / {
try_files $uri $uri/ /index.php;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/*****./fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/*****./privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = *****.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name *****.com;
return 404; # managed by Certbot
}
and my php call
Sentry\init(['dsn' => 'https://*****.ingest.sentry.io/***' ]);
throw new Exception("Sentry is working on ".$_ENV['ENV']." machine!");
While composer is installed using this composer.json part
"require": {
"sentry/sdk": "^3.1",
....
Any ideas or any ideas how to debug this?
UPDATE
The error log file finds this (so the error is captured):
2021/07/02 13:22:12 [error] 17232#17232: *193 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Exception: Sentry is working on TEST machine! in /var/www/services/some-service/Config/sentryloader.php:13
Stack trace:
#0 /var/www/services/some-service/Config/bootstrap.php(15): include()
#1 /var/www/services/some-service/index.php(6): include('/var/www/servic...')
#2 {main}
thrown in /var/www/services/some-service/Config/sentryloader.php on line 13" while reading response header from upstream, client: ****ip****, server: ****.com, request: "GET /get HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php-fpm.sock:", host: "****.com"
UPDATE: snippets/fastcgi-php.conf
:
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
0 Answers