You are not logged in.

#1 2019-01-16 01:00:03

bikerpierre
Member
From: Boston, MA US
Registered: 2015-12-23
Posts: 5

[SOLVED] Apache&nginx serving nextcloud and odoo

Hello,

I'm trying to run nginx as a reverse proxy to serve odoo via odoo.example.com. I have nginx listening on port 225 for plain traffic and 543 for ssl traffic since apache is listening to ports 80 and 443 respectively for nextcloud.

Apache is serving nextcloud fine. When I type ipadress:8069 for odoo, (the port its built in webserver listens to) I get connected. However when I type in the FQN odoo.example.com, nginx doesn't serve ipaddress:8063. Proxy pass is set to http://ipaddress:8069. The server name is set to odoo.example.com in nginx.



Both webservers use certbot letsencrypt ssl configuration with a redirect. Nextcloud uses mariadb for its database backend and odoo's webserver uses postgresql for its database backend.

Port forwarding is set up correctly with the correct host records pointing the subdomains to the right public IP address. I wilm input config files when I'm out of work. Please let me know of some suggestions.

Last edited by bikerpierre (2019-01-17 06:31:02)

Offline

#2 2019-01-16 08:00:02

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

bikerpierre wrote:

Apache is serving nextcloud fine. When I type ipadress:8069 for odoo, (the port its built in webserver listens to) I get connected. However when I type in the FQN odoo.example.com, nginx doesn't serve ipaddress:8063. Proxy pass is set to http://ipaddress:8069. The server name is set to odoo.example.com in nginx

Isn't that to be expected?
If you want to access odoo via nginx you should be trying to visit odoo.example.com:225 as that's the port nginx is listening to.

If you want to access everything via ports 80/443 then use nginx as a reverse proxy for both applications (or just reverse-proxy odoo and serve nextcloud natively with nginx).


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2019-01-16 13:04:31

bikerpierre
Member
From: Boston, MA US
Registered: 2015-12-23
Posts: 5

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

upstream odoo {
    server ipaddress:8069;
}

server {
    listen 225;
    server_name odoo.example.com;
    root        /usr/share/nginx/html;
    index       index.html index.htm;
    access_log  /var/log/nginx/odoo-example-com.access.log;
    error_log   /var/log/nginx/odoo-example-com.error.log;

    location / {
        proxy_pass  http://ipaddress:8069;
        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        # set headers
        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;
    }

    # cache some static data in memory for 60mins
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://ipaddress:8069;
    }

    listen 543 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/odoo.example.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/odoo.example.org/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

When I type odoo.example.com:225, I still get a connection error

Last edited by bikerpierre (2019-01-16 13:13:51)

Offline

#4 2019-01-16 13:10:30

bikerpierre
Member
From: Boston, MA US
Registered: 2015-12-23
Posts: 5

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

Worse comes to worst I'll try your method, but I really don't want to reconfigure apache and disrupt nextcloud

Offline

#5 2019-01-16 13:15:30

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,992
Website

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

1) In your OP you (also) mentioned port 8063. Was this a typo or did you mix up port numbers?
2) "odoo.example.com" is not a FQDN. There's a dot missing at the end, but this should not matter to your browser or reverse proxy.
3) You only proxy pass http connections to the respective port. If the provider has a redirection in place, this will yield a status of 30x and cause the proxy to fail. Google it.
Update: If you want more detailed help, provide nginx's logs.

Last edited by schard (2019-01-16 13:17:38)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#6 2019-01-16 14:56:34

progandy
Member
Registered: 2012-05-17
Posts: 5,201

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

Slithery wrote:

If you want to access everything via ports 80/443 then use nginx as a reverse proxy for both applications (or just reverse-proxy odoo and serve nextcloud natively with nginx).

Or keep nextcloud natively in apache and add a virtual host with ProxyPass for odoo in apache.

Last edited by progandy (2019-01-16 14:57:26)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2019-01-16 16:40:44

bikerpierre
Member
From: Boston, MA US
Registered: 2015-12-23
Posts: 5

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

progandy wrote:
Slithery wrote:

If you want to access everything via ports 80/443 then use nginx as a reverse proxy for both applications (or just reverse-proxy odoo and serve nextcloud natively with nginx).

Or keep nextcloud natively in apache and add a virtual host with ProxyPass for odoo in apache.

Apologies for the typos; I was at work and needed to type fast. I'm going to do this and see what happens. Thank you everyone

Offline

#8 2019-01-16 19:11:12

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

progandy wrote:

Or keep nextcloud natively in apache and add a virtual host with ProxyPass for odoo in apache.

That did spring to my mind, but it's been at least a decade since I've used Apache and I wasn't sure if that was a thing yet smile


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2019-01-17 05:48:48

bikerpierre
Member
From: Boston, MA US
Registered: 2015-12-23
Posts: 5

Re: [SOLVED] Apache&nginx serving nextcloud and odoo

Ok it works now. I set up apache natively serving nextcloud with odoo running inside a virtual host and reverse proxy. Thank you everyone. I will mark solved.

Last edited by bikerpierre (2019-01-17 06:28:45)

Offline

Board footer

Powered by FluxBB