Use proxy_pass to forward traffic to owncloud server

forumacct nginx-forum at forum.nginx.org
Thu Jan 19 10:33:21 UTC 2017


Hello All,

I have 2 Raspberry Pi both with nginx.
RPI#1 is plain website (using http) (listening on port 8000) (local IP
192.168.11.170)(nginx : 1.2.1-2.2 )
RPI#2 is an owncloud server (using https) (local IP
192.168.11.176)(1.6.2-5+deb8u4)

My dyndns domain name gets routed to RPI#1.
nginx on RPI#1 uses following server & proxy_pass stanza:

server {
	listen   8000; ## listen for ipv4; this line is default and implied
        listen     80;
        listen    443;
	#listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

	root /media/usbstick/nginx/www;
	index index.php index.html index.htm;

	# Make site accessible from http://localhost/
	server_name rpi1;

        ... other location stanzas ...

        location /owncloud {
                proxy_pass http://192.168.11.176:80;
        }

If I put a minimum http config file on RPI#2 it works.
upstream php-handler {
server 127.0.0.1:9000;
}
server {
listen 80;
root /media/usbstick/nginx/www/owncloud;
server_name rpi3;
        location / {
                try_files $uri $uri/ /index.html;
                ssi on;
        }
}

With following index.html file.

<!DOCTYPE>
<html>
<head>
<title>Under Construction</title>
</head>
<body>
<p>This page is under construction. Please come back soon!</p>
</body>
</html>

When entering 192.168.11.170/owncloud I get the 'under construction'
message.
That is confirmed from local LAN or from WAN when using my dyndns domain.

When I'm using the nginx config provided by owncloud tutorial:
https://normally.online/2016/04/29/owncloud-9-0-1-on-raspberry-pi-3-step-by-step/

This one puts all traffic on https.
...
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}

server {
listen 80;
server_name xxxxxxx.dyndns.ws;
return 301 https://$server_name$request_uri;  # enforce https
}

server {
listen 443 ssl;
server_name xxxxxxx.dyndns.ws;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
... more stuff ...


I get this error (firefox).
An error occurred during a connection to xxxxxx.dyndns.ws. SSL received a
record that exceeded the maximum permissible length. (Error code:
ssl_error_rx_record_too_long) 

What's the proper setup of getting the https traffic to work?

Thanks,
Gert

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272050,272050#msg-272050



More information about the nginx mailing list