I have my NGINX configuration file set up as so
root /var/www/html/tests_manager/webroot;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name qa.kloc.co.uk; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
rewrite ^/uploads/(.*) /uploads/uploadsController.php last;
try_files $uri $uri/ =404;
}
location /support {
root /var/www/html/support-manager/webroot; #I have checked, this directory exists.
}
location = /notifications {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location = /supportSocket {
proxy_pass http://localhost:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
I want the /support
location to redirect to a different root, so that when the user tries to access qa.kloc.co.uk/support
they see the site in the directory /var/www/html/support-manager/webroot
My issue is that whenever I try to browse to this URL, I just receive a 404 error. I checked the access logs and they were not helpful. I just see
GET /support/index.php HTTP/1.1" 404 209
there is nothing in the error log.
I tried using a rewrite (like with /uploads/) but I don't think I can escape the root directory. I also tried to use location = /support
and location ^~ /support
but these had no effect.
I have also tried changing owner of the /var/www/html/support-manager/webroot/
directory to www-data
but this did not make a difference.
Please help me with the correct way to write /support location