#Use this example for proxy traffic to the document server running at 'backendserver-address'.
upstream docservice {
server backendserver-address;
}
map $http_host $this_host {
"" $host;
default $http_host;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $this_host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_tokens off;
location / {
proxy_pass http://docservice;
proxy_http_version 1.1;
}
}
My docker ps command show this content:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e52372f4596 onlyoffice/documentserver "/app/ds/run-documen…" 2 days ago Up 2 days 443/tcp, 0.0.0.0:5000->80/tcp, :::5000->80/tcp romantic_mirzakhani
What parameter must I change in the minimal.conf file?
Thank you!
And then I restart with “systemctl restart nginx”
But I get an error:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-04-28 13:49:13 CEST; 9s ago
Docs: man:nginx(8)
Process: 360467 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Apr 28 13:49:13 serv90514217 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 28 13:49:13 serv90514217 nginx[360467]: nginx: [emerg] invalid host in upstream "http://localhost:5000" in /etc/nginx/conf.d/proxy-https-to-http.conf:2
Apr 28 13:49:13 serv90514217 nginx[360467]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 28 13:49:13 serv90514217 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Apr 28 13:49:13 serv90514217 systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 28 13:49:13 serv90514217 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Hello! In your config file (proxy-https-to-http.conf) the address should be typed in without “http://” because that part is already specified later in the config. In your case it should look like this:
Helo,
I have now change and delete the “http://”, but after restart nginx also an error occured:
`● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-04-28 15:30:26 CEST; 18s ago
Docs: man:nginx(8)
Process: 365060 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Apr 28 15:30:26 serv90514217 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/proxy-https-to-http.conf:50
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default:23
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 28 15:30:26 serv90514217 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Apr 28 15:30:26 serv90514217 systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 28 15:30:26 serv90514217 systemd[1]: Failed to start A high performance web server and a reverse proxy server.`
Hello,
This output contains an explanation of where exactly the reason of the issue is. There can be only one default_server, so you have to remove this directive from other configs.