This question has been flagged
1 Reply
3741 Views

when i try to accesses with subdomain with port it direct me to domain.com/web/login and make another direct to /web/login without domain
when i 
 try to accesses with domain.com/web/login it works and it works if authorized with odoo db

# odoo servers

upstream odoo {
 server 127.0.0.1:8069;

}

# HTTP -> HTTPS
server {
    listen 8006;  
    server_name server_name.com;

     include snippets/letsencrypt.conf;
     #return 301  https://server_name.com:8006$request_uri;
     #rewrite ^(.*) https://$host$1 permanent;
     return 301  https://server_name.com:8006$request_uri;
}


server {
 
    listen [::]:443 ssl default_server;
    listen 443 ssl;

    server_name server_name.com;
    
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    # Proxy headers
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;

    # SSL parameters
     ssl off;
     ssl_certificate /etc/ssl/server_name.crt;
     ssl_certificate_key /etc/ssl/server_name.key;
 
     


 #   include snippets/ssl.conf;
 #   include snippets/letsencrypt.conf;

    # log files
    access_log /var/log/nginx/odoo.access.log;
    error_log /var/log/nginx/odoo.error.log;

    # Handle / requests
    location / {
     #proxy_pass https://server_name.com:8006/;
     proxy_set_header Host  https://server_name.com:8006/;
     #proxy_redirect off;
     proxy_pass http://odoo;
    }
  

Avatar
Discard
Best Answer

Just check:

https://www.odoo.com/documentation/13.0/setup/deploy.html#id7

set correctly for port 80, then if you run certbot it will generate the correct redirect to https



Avatar
Discard
Author

port 80 is already used for another subdomain , no need to run certbot i already have custome certificate

Ok, this is how the redirect should look

server {

if ($host = odoo.yourdomain.com) {

return 301 https://$host$request_uri;

}

listen 8006 default_server; # or whatever your http port is

server_name odoo.yourdomain.com;

return 404;

}