Hello there,
We now have nginx installed on Our Ubuntu 14.04. it seems a great software.
Now, we can enter test.lapagept.com (port 80) to get our original address : 223.26.196.31:8070 (odoo test server). Our domain name (test.lapagept.com) stays in the browser's address bar. No port number is displayed. good.
But what happens with those one they have this old 23.226.196.31:8070 bookmarked? They still want to connect with this old address...
We are trying this (bold) setup in our /etc/nginx/sites-enabledtest.lapagept.com file :
upstream odoo-test {
server 127.0.0.1:8070;
}
server {
listen 443;
server_name test.lapagept.com;
access_log /var/log/nginx/test.lapagept.com.access.log;
error_log /var/log/nginx/test.lapagept.com.error.log;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
keepalive_timeout 60;
ssl_ciphers HIGH:!ADH:!MD5;
ssl_protocols SSLv3 TLSv1;
ssl_prefer_server_ciphers on;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://odoo-test;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo-test;
}
}
# This allows for someone to go to http and get redirected to https automatically
server {
listen 80;
server_name test.lapagept.com;
add_header Strict-Transport-Security max-age=2592000;
return 301 http://test.lapagept.com$request_uri;
}
# This allows for someone to go to http and get redirected to https automatically
server {
listen 8070;
server_name 23.226.196.31;
add_header Strict-Transport-Security max-age=2592000;
return 301 http://test.lapagept.com$request_uri;
}
Without the bold lines, all seems good.
With the bold lines, we get this error :
nginx: [emerg] bind() to 23.226.196.31:8070 failed (99: Cannot assign requested address)
Could you help please? Idea?
I use Apache myself, so I'm not firm with nginx, but why don't you use the same URL rewrite for port 8070 as for port 80 (with the $request_uri part appended)?
Corrected. Result is the same. Thanks.
Ideas? hmmm - add odoo-test.lapagept.com to the server_name - put the 8070 server block before the 80 server block Maybe you give it a try...
(update above, ermin trevisan means test.lapagept.com)