我已经这样设置了NGINX配置文件
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;
}
我希望/support
位置重定向到另一个根目录,以便用户尝试访问qa.kloc.co.uk/support
时,他们可以在目录/var/www/html/support-manager/webroot
中看到该站点
我的问题是,每当尝试浏览该URL时,我只会收到404错误。我检查了访问日志,但它们没有帮助。我只是看到
GET /support/index.php HTTP/1.1" 404 209
错误日志中没有任何内容。
我尝试使用重写(例如/ uploads /),但我认为我无法转义根目录。我也尝试使用location = /support
和location ^~ /support
,但它们没有任何作用。
我还尝试过将/var/www/html/support-manager/webroot/
目录的所有者更改为www-data
,但这没有什么不同。
请帮助我以正确的方式编写/ support位置