I'm trying to make Nginx serve Cacti (a php monitoring app) from a subdomain, using the following configuration:
server {
listen 80;
server_name cacti.mydomain.net;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name cacti.mydomain.net;
root /usr/share/webapps/cacti;
index index.php;
charset utf-8;
location ~ \.php?$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
access_log /var/log/nginx/cacti.access.log main;
error_log /var/log/nginx/cacti.error.log warn;
include ssl.conf;
}
However, when I go to https://cacti.mydomain.net/, Nginx returns a 404. The error log shows lines like this one:
[error] 41809#41809: *26 open() "/usr/share/webapps/cacti/cacti/include/themes/modern/images/cacti_logo.gif" failed (2: No such file or directory), client: 83.162.2.169, server: cacti.mydomain.net, request: "GET /cacti/include/themes/modern/images/cacti_logo.gif HTTP/2.0"
It looks like the request is going where the file is, but it tries to open it from the wrong place (cacti/cacti/include/...)
I've tried different location blocks, but that changes the url to https://cacti.mydomain.net/cacti/ which is not what I want. Can someone tell me what I'm missing here? Thanks for any help!