-1

I'm trying to configure domain in a way, so I could use subdomain for accessing database. For example if my domain is domain.com and I have databases demo and demo2. Then I should be able to access it by writing demo.domain.com and demo2.domain.com. But none of this work. I followed this guide: http://opensourceholic.com/2014/05/09/deploy-openerp-using-mod_proxy-and-mod_wsgi-on-linux-server/

After doing everything by the guide, what I was able to do, was I can only access OpenERP (or Odoo) web by writing domain.com, but if I write demo.domain.com, I will only get this message This webpage is not available.

So what I did:

My apache2 configuration files:

openerp.conf

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias *.domain.com // Use this if you want dbfillter on subdomain
    ErrorLog /var/log/openerp/openerp-error.log
    CustomLog /var/log/openerp/openerp-access.log combined
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyRequests Off
    ProxyPass / http://domain.com:8069/
    ProxyPassReverse / http://domain.com:8069/
    ProxyVia On
    LogLevel warn
</VirtualHost>

openerp-wsgi.conf:

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias *.domain.com // Use this if you want dbfillter on subdomain
    WSGIScriptAlias / /opt/openerp/server/openerp-wsgi.py
    WSGIDaemonProcess oe user=user group=oerp processes=2 python-path=/opt/openerp/server/ display-name=apache-openerp
    WSGIProcessGroup oe
    ErrorLog /var/log/openerp/openerp-error.log
    CustomLog /var/log/openerp/openerp-access.log combined
    <Directory /opt/openerp/server>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

My openerp-wsgi.py configuration:

import openerp

#----------------------------------------------------------
# Common
#----------------------------------------------------------
openerp.multi_process = True # Nah!

# Equivalent of --load command-line option
openerp.conf.server_wide_modules = ['web']
conf = openerp.tools.config

# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)

conf['addons_path'] = '/opt/openerp/server/addons/,/opt/openerp/server/openerp/addons/'

# Optional database config if not using local socket
#conf['db_name'] = 'demo'
conf['db_host'] = '127.0.0.1'
conf['db_user'] = 'user'
conf['db_port'] = 5433
conf['db_password'] = 'password'
#conf['dbfilter'] = '%d'
#----------------------------------------------------------
# Generic WSGI handlers application
#----------------------------------------------------------
application = openerp.service.wsgi_server.application

openerp.service.server.load_server_wide_modules()

#----------------------------------------------------------
# Gunicorn
#----------------------------------------------------------
# Standard OpenERP XML-RPC port is 8069
bind = '0.0.0.0:8069'
pidfile = '.gunicorn.pid'
workers = 4
timeout = 240
max_requests = 2000

And even after doing this, it still was not working, so I added this line in /etc/hosts:

127.0.0.1 domain.com Then I was able to access OpenERP when entering domain.com address, but only this. If I add suggested filter (either directly in config file or in openerp-wsgi.py file), then system does not find any database and I can't access any of it, even in the list, not to mention the main reason I'm doing this - to access by subdomain (as written in an example).

So what is wrong here?

Note. I'm trying this on Odoo v8 (formerly OpenERP).

  • Why down vote?... – Andrius Oct 10 '14 at 12:10
1

You have two virtualhost files for the same domain, at for the same port. You need just one file for this. Choose if you want to serve your Odoo using mod_proxy or mod_wsgi, but not both.

0

I figured I need to manually enter all subdomains in etc/hosts, only then it starts working I expected.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.