Sub-domain filtering can be allowed in Odoo, allowing users to run various Odoo databases on different sub-domains. This means you can have several Odoo websites/apps for various purposes. That means if you have a domain ‘mydomain.com’, you can use its subdomains to access other databases. For example test01.mydomain.com, test02.mydomain.com, test03.mydomain.com, etc.
Wildcard records are a form of resource record that will fit one or more subdomains if those subdomains don't have any resource records identified for them. An asterisk (*) followed by a dot is used as the leftmost domain name mark in wildcard documents (.)as shown here: *.mydomain.com.The requests to the domain www.mydomain.com, will never trigger the *.mydomain.com wildcard records. Wildcard records can be used with any DNS resource record type except name server records.
Install the Odoo version in your system
Once the Odoo installation is complete, edit the Odoo configuration file (/etc/odoo.conf) and configure it for subdomain filtering, add dbfilter = ^%d$
sudo nano /etc/odoo.conf
[options]
; This is the password that allows database operations:
admin_passwd = Adm1NPa55w0^D
db_host = False
db_port = False
db_user = odoo
db_password = False
dbfilter = ^%d$
[options]
logfile = /var/log/odoo/odoo-server.log
addons_path=/odoo/odoo-server/addons,/odoo/custom/addons
xmlrpc_port = 8069
Install Nginx reverse proxy
After installing the Nginx, configure the Nginx conf file.
server {
server_name mydomain.com *.mydomain.com;
listen 80;
access_log /var/log/nginx/testing-access.log;
error_log /var/log/nginx/testing-error.log;
location /longpolling {
proxy_connect_timeout 3600;
proxy_read_timeout 3600;
proxy_send_timeout 3600;
send_timeout 3600;
proxy_pass http://127.0.0.1:8072;}
location / {
proxy_connect_timeout 3600;
proxy_read_timeout 3600;
proxy_send_timeout 3600;
send_timeout 3600;
proxy_pass http://127.0.0.1:8069/;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
gzip on;
gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
A wildcard DNS record is a record that answers DNS requests for any subdomain you haven't already defined. Here mydomain.com will be your main domain. And *.mydomain.com is the wild card domain.
Domain manager
If you are using the GoDaddy domain host manager then follow the steps. The instructions are unique to Godaddy, and your own hosting provider's instructions can vary.
- Log in to your GoDaddy account. Click on your domain. Then select the Manage DNS button.
- Select the Add button and Choose A for type. Host as ‘@’ for the main domain.
- Give the Points to IP in the points to field.
- For TTL(Time To Leave) choose custom and give a minimum of 600 seconds.
- Then Save.
For Wild cards
- Select the Add button and Choose A for type. Host as ‘ *. ’ for subdomains.
- Give the Points to IP in the points to field.
- For TTL(Time To Leave) choose custom and give a minimum of 600 seconds.
- Then Save.
Now you are ready to access the domain and subdomains.
After these setups create your database which you want to be a subdomain of your database. Please make sure to create the database which has the same name that you want to be as your subdomain. For example, you want to make core.mydomain.com as your domain, then create a database with the name ‘core’. Then create a record in the domain host manager.
After 10 minutes(600 seconds) You can access the core database with your ‘http://core.mydomain.com’domain.