我对 Apache 和 Nginx 感到头疼。当我认为一个人在工作时,另一个人不工作,反之亦然......
稍微解释一下:
我有一台“安装”了 Nextcloud 的服务器,它与 Apache2 和 MySQL 一起使用。
我有一个带有 Nginx 的 Raspberry PI,它充当反向代理。
我之前有这个设置工作,当时它不是一个干净的,所以我撕掉了所有东西,并希望有一个干净的配置重新开始。
路由器 80/443 => Nginx RP => Nextcloud
我尝试了许多配置文件和文档,现在我陷入了困境:
502 错误网关 nginx/1.10.3
无论我对 Apache 或 Nginx 进行什么更改,我仍然会收到相同的消息...
这是我的 Nginx 反向配置文件:
server {
listen rproxy_IP:80;
server_name cloud.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen rproxy_IP:443 ssl;
server_name cloud.domain.com;
#Log storage
access_log /var/log/nginx/cloud.domain.access.log;
error_log /var/log/nginx/cloud.domain.error.log;
#SSL Configurations
ssl on;
ssl_certificate /etc/nginx/ssl/crt.crt;
ssl_certificate_key /etc/nginx/ssl/key.key;
ssl_stapling on;
ssl_stapling_verify on;
location / {
add_header Front-End-Https on;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# whatever the IP of your cloud server is
proxy_pass https://nextcloud_IP;
}
}
当我查看日志时,我得到了这个:
2018/08/27 13:42:25 [error] 19756#19756: *1 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: **Public_IP**, server: **cloud.domain.com**, request: "GET / HTTP/1.1", upstream: "https://**nextcloud_IP**:443/", host: "**cloud.domain.com**"
我很难理解这一点,因为在今天早上之前我有相同的确切配置而且我没有问题。
现在这是我的 Nextcloud 的 Apache 配置:
<VirtualHost rproxy_IP:80>
DocumentRoot "/var/www/nextcloud"
ServerName cloud.domain.com
Redirect permanent / https://cloud.domain.com/
Alias cloud.domain.com /var/www/nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any
</Directory>
</VirtualHost>
以下是 Apache 日志:
[Mon Aug 27 13:21:19.874269 2018] [mpm_prefork:notice] [pid 36967] AH00169: caught SIGTERM, shutting down
[Mon Aug 27 13:21:20.899777 2018] [mpm_prefork:notice] [pid 37263] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Aug 27 13:21:20.899811 2018] [core:notice] [pid 37263] AH00094: Command line: '/usr/sbin/apache2'
我不得不提到我使用通配符。
路由器有 80/443 转发到反向代理反向代理获取 http 并将其“升级”到 https,然后将请求转发到 Apache-Nextcloud。证书效果很好。
请帮助我,我不明白我做错了什么或什么不起作用以及为什么不起作用。如果您需要更多信息,请告诉我。我不能透露你所理解的域名、内部 IP 和公共 IP。
提前感谢您的回答。