This question has been flagged
9 Replies
10233 Views

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?

Avatar
Discard

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)?

Author

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...

Author

(update above, ermin trevisan means test.lapagept.com)

Best Answer

I may have missed something but you can't have two applications (Odoo and Nginx) listenning on the same port (8070).

If you haven't touched your firewall configuration, users should still be able to access http://23.226.196.31:8070

Avatar
Discard
Author

Thanks for your comment. So, if I well understand, I'm losing my time with this. I can use http://23.226.196.31:8070 in my browser, but it won't be rename in the browser address bar for http://test.lapagept.com... This is not a problem. I try this soon.

Best Answer

Yes you can, but, you need to bind odoo to listen only to 127.0.0.1 requests, (in config file set : proxy_mode = True, xmlrpc_interface = 127.0.0.1, also xmprpcs_interface=127.0.0.1) then you can make nginx listen to 8070 and even redirect 8070 (old bookmark) to https (443) ... hope it helps

Avatar
Discard
Author

VEry interesting. We are near of the Verity! thanks

Author Best Answer

Thanks all for your precious comments.

Avatar
Discard