我正在尝试在不同位置运行 Nextcloud、主页和文书工作,但无法弄清楚如何正确配置我的 nginx-config。
我的工作树如下所示:
/var/www/
|-> 网站
|-> nextcloud
|-> 文书工作
我的主页可以通过 web.domain.com 访问,而我的 Nextcloud 可以通过 cloud.domain.com 访问。现在我想让 Paperwork 可以在 web.domain.com/notes 下访问。Paperwork 的 index.php 位于子文件夹“paperwork/frontend/public”中。
这是我解决这个问题的尝试(没有整个 ssl 和云部分):
server{
listen 443 ssl http2;
server_name web.domain.com;
error_log /var/log/nginx/debug.log debug;
root /var/www/website;
location / {
index index.php index.html;
}
location /notes {
alias /var/www/paperwork/frontend/public;
index index.php index.html index.htm;
try_files $uri $uri/index.php;
}
location ~ /(nextcloud|backups) {
deny all;
return 403;
}
location ^~ /nextcloud/ {
deny all;
return 402;
}
location ^~ /nextcloud/ {
deny all;
return 402;
}
location ~ \.php$ {
try_files $uri =404;
alias /var/www/paperwork/frontend/public;
index index.php index.html index.htm;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我尝试了很多不同的解决方案,但我得到了 404,因为他使用了错误的目录并且找不到 /var/www/notes/index.php (或类似的错误)或者 nginx 只返回了 index.php作为文件下载。
提前谢谢!