简体   繁体   English

Nginx中的Nextcloud反向代理?

[英]Reverse proxy in nginx for nextcloud?

How do I set a reverse proxy for nextcloud? 如何为nextcloud设置反向代理? This is my current config but it doesn't work: 这是我当前的配置,但不起作用:

server {
  listen 8000;
  server_name cloud.prjctdesign.com;
  return 301 https://$host$request_uri;
}

server {
  listen 4430 ssl http2;
  server_name cloud.prjctdesign.com;

  ssl_certificate /certs/cloud.prjctdesign.com.crt;
  ssl_certificate_key /certs/cloud.prjctdesign.com.key;

  include /etc/nginx/conf/ssl_params.conf;

  client_max_body_size 10G; # change this value it according to $UPLOAD_MAX_SIZE

  location / {
    proxy_pass http://192.168.178.32;
    include /etc/nginx/conf/proxy_params;
  }
}

Also I enabled SSL using a let's encrypt cert. 另外,我还使用了加密证书功能启用了SSL。 I run Nextcloud in the official VM image provided by Nextcloud / Techandme 我在Nextcloud / Techandme提供的官方VM映像中运行Nextcloud

I believe there is something wrong with the HSTS but I have no idea how it works. 我相信HSTS有点问题,但我不知道它是如何工作的。 Also I based my forwarding off of this 我也基于转发

I figured it out. 我想到了。 The reference to the ssl certificate is incorrect. ssl证书的引用不正确。 Either run NGINX on the same server you are running nextcloud and redirect nginx to the position of the .cert file as in these lines: 在运行nextcloud的同一台服务器上运行NGINX,然后将nginx重定向到.cert文件的位置,如下所示:

 ssl_certificate /certs/cloud.prjctdesign.com.crt;
 ssl_certificate_key /certs/cloud.prjctdesign.com.key;

or generate a new cert on the nginx server and point the config towards it. 或在Nginx服务器上生成新证书,然后将配置指向该证书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM