So I did several things to see if I could fix things. I learned a little more about my server setup along the way.
First, I changed the permissions of the plugin file I put into the plugins folder to match the other items in the folder osticket:osticket.
Second, I went poking around the nginx config files.
I added, incorrectly, the following to line /etc/nginx/conf.d/tickets.mysite.com.conf:
try_files $uri $uri/ /var/www/osticket/api/http.php?$query_string;
}
This line did change my error from 404 to "File not found." After changing it, I realized my previous error was always "404 Not Found | nginx" and not just 404.
I later found /etc/nginx/conf.d/tickets.mysite.com.d/osticket.conf already has a directive for the API, which is when I removed the previous change. I poked around some more and found that I'm using PHP8.0, and all the configs look right to me, but just a little different than I've seen before.
I found something interesting. Visiting tickets.mysite.com/api/some.php will always download that file; it doesn't happen with other PHP files, and I was able to test 2 other installs, one setup with Cloudron and one manually installed, and both of them render an error or message of some kind.
The one thing that looked different to me was in the /etc/nginx/conf.d/tickets.mysite.com.d/
location ~ ^/api/(?!http.php/)(.*) {
try_files $uri $uri/ /api/http.php/$1;
}
location ~ ^/pages/(?!index.php/)(.*) {
try_files $uri $uri/ /pages/index.php/$1;
}
location ~ ^(.*[^/]\.php)(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm-osticket.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
I changed that to:
location ~ ^/api/(?!http.php/)(.*) {
try_files $uri $uri/ /api/http.php/$1;
}
location ~ ^/pages/(?!index.php/)(.*) {
try_files $uri $uri/ /pages/index.php/$1;
}
location ~ ^(.*[^/]\.php)(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm-osticket.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Which did not affect my task or the download of the files from the API directory, which confused me.
Next, I just made some further simple edits:
location / {
try_files $uri $uri/ /index.php;
}
location /api/ {
try_files $uri $uri/ /api/http.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm-osticket.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
This allowed me to process the /api/ directory which I placed a file called test.php
<?php
echo "<pre>SERVER: ";
print_r($_SERVER);
echo "REQUEST: ";
print_r($_REQUEST);
echo "</pre>";
?>
I was stuck there since it has been so long since I have worked on the core of PHP stuff. My brain is fried for the day, but I hope someone who knows better can give some insight.
Thank you