Community mailing list archives

community@mail.odoo.com

Re: Muliple Odoo Website on single port

by
Andi Becker
- 05/21/2016 00:06:12
Have you checked out this here:


and that


as well as this here


and


for NginX


---

but the reason you are having problems might be that here:


A/B testing is the ability to have multiple versions of your website its pages and being able to show x% version X and x% version Y. And this depends. If you host it on Odoo their SaaS platform you still won't see the code. I'm not sure what the case is with non-Odoo partners that want to buy the enterprise code though. I'd drom them an e-mail at sales@odoo.com

As this is available in Version 8 and there is a backport simply "rewrite" the A/B Testing ;-) might be a solution for you!

---

The same applies to the Form Builder - I recommend having a look to the one of Processwire and integrating that ;-)

or Call to action blocks which are not so difficult to get up and running in Community too

and of course Versioning - a nice feature which was available but which is now only in Enterprise of Version 9 - also here I recommend simply "rewrite" the module for Version 9 ;-) 

Most other things mentioned on that list you will be able to achieve also in Community Edition.

---

Concerning Multiwebsites in Odoo simply orient yourself on 8 - do the same on 9 (but get the parts missing from 8 to 9 before)

don't forget to check out this here as it discusses Version 10!


There are still major problems with multi-domains and multi-websites in one Odoo. They are IMHO mainly caused by the website-builder itself and they can be changed by changing those problems by eliminating those problems in website builder. It is mainly a problem on how website URLs of pages get rewritten in website builder. 

Doing it the way i.e. like TYPO3 and some other Enterprise CMS are doing it would solve the problem! 

---

To describe the whole process would take simply to much words and some people here won't be happy with such a long post. Perhaps they can provide a better and shorter solution/description to you to get multiple websites running on Odoo 9 Community Edition.

Have a nice weekend

Andi


On Fri, May 20, 2016 at 5:07 PM, zoya patel <zoya27p@gmail.com> wrote:
Hi ANDI BECKER,

Thanks for your valuable reply. i checked your configuration and based on my understanding i think you are running two sites on same server. I think both sites contain same menu, pages and content.

If your site contain same content than my configuration also works as expected. but in my case we have differnt sites with total different content.

Let me know if your configuration works for different content (per website) also, i will rework on your configuration and will try to point out issue.

Thanks.

On Fri, May 20, 2016 at 1:52 PM, Andreas Becker <andi@lisandi.com> wrote:
Hi Zoya

Here is an example with 2 sites running in one Odoo:

We use Apache2 on Ubuntu in that example.

in etc/apache2/sites-available you need to create for this example two virtual hosts - manually or i.e. via virtualmin/webmin etc and change the entry later like in that example as the customer is running also other sites on the same server which he manages with virtualmin.

dev.mydomain.de.conf - will look like that
---
<VirtualHost *:80>

SuexecUserGroup "#1000" "#1000"

ServerName dev.mydomain.de
ServerAlias www.dev.mydomain.de

DocumentRoot /home/customer1/domains/dev.mydomain.de/public_html

ErrorLog /var/log/virtualmin/dev.mydomain.de_error_log
LogLevel warn
CustomLog /var/log/virtualmin/dev.mydomain.de_access_log combined

ScriptAlias /cgi-bin/ /home/customer1/domains/dev.mydomain.de/cgi-bin/

DirectoryIndex index.html index.htm index.php index.php4 index.php5

<Directory /home/customer1/domains/dev.mydomain.de/public_html>

Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

AddType application/x-httpd-php .php

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/customer1/domains/dev.mydomain.de/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/customer1/domains/dev.mydomain.de/fcgi-bin/php5.fcgi .php5

</Directory>

<Directory /home/customer1/domains/dev.mydomain.de/cgi-bin>

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

</Directory>

<IfModule mod_rewrite.c>

RewriteEngine On

# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^dev.mydomain.de
RewriteRule ^/(.*)$ http://dev.mydomain.de/$1 [R=301,NE,L]

# Redirect 301 to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,NE,L]

</IfModule>

RemoveHandler .php
RemoveHandler .php5

FcgidMaxRequestLen 1073741824

<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>

<Location /git>

DAV on

AuthType Basic
AuthName dev.mydomain.de
AuthUserFile /home/customer1/domains/dev.mydomain.de/etc/git.basic.passwd

Require valid-user
Satisfy All


RewriteEngine off

AddHandler cgi-script .cgi

</Location>

</VirtualHost>

<VirtualHost 123.456.789.0:443 [a123:b456:c789:de0f::2]:443>

SuexecUserGroup "#1000" "#1000"

ServerName dev.mydomain.de
ServerAlias www.dev.mydomain.de

DocumentRoot /home/customer1/domains/dev.mydomain.de/public_html

ErrorLog /var/log/virtualmin/dev.mydomain.de_error_log
LogLevel warn
CustomLog /var/log/virtualmin/dev.mydomain.de_access_log combined

ScriptAlias /cgi-bin/ /home/customer1/domains/dev.mydomain.de/cgi-bin/

DirectoryIndex index.html index.htm index.php index.php4 index.php5

<Directory /home/customer1/domains/dev.mydomain.de/public_html>

Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

AddType application/x-httpd-php .php

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/customer1/domains/dev.mydomain.de/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/customer1/domains/dev.mydomain.de/fcgi-bin/php5.fcgi .php5

</Directory>
<Directory /home/customer1/domains/dev.mydomain.de/cgi-bin>

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted

</Directory>

SSLEngine on
SSLProtocol           all -SSLv2 -SSLv3
SSLCipherSuite         ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /home/customer1/domains/dev.mydomain.de/ssl.cert
SSLCertificateKeyFile /home/customer1/domains/dev.mydomain.de/ssl.key

RequestHeader set X-Forwarded-Proto "https"

<IfModule mod_rewrite.c>
RewriteEngine On

# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^dev.mydomain.de
RewriteRule ^/(.*)$ https://dev.mydomain.de/$1 [R=301,NE,L]
</IfModule>

RemoveHandler .php
RemoveHandler .php5

FcgidMaxRequestLen 1073741824

<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>

<Location "/web/database" >
Order deny,allow
Deny from all
Allow from 61.0.249.127 64.167.94.28 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>

<Location "/website/info" >
Order deny,allow
Deny from all
Allow from 61.0.249.127 64.167.94.28 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>

<Location /git>

DAV on
AuthType Basic
AuthName dev.mydomain.de
AuthUserFile /home/customer1/domains/dev.mydomain.de/etc/git.basic.passwd
Require valid-user
Satisfy All

RewriteEngine off

AddHandler cgi-script .cgi

</Location>

# Comment to disable proxy
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /longpolling/        http://localhost:8072/longpolling/ retry=0
ProxyPassReverse /longpolling/ http://localhost:8072/longpolling/ retry=0
ProxyPass /                    http://localhost:8069/ retry=0
ProxyPassReverse /             http://localhost:8069/ retry=0

</VirtualHost>

======== // ===========

site2.mydomain.de.conf - will look like that:
----------

<VirtualHost *:80>

SuexecUserGroup "#1000" "#1000"

ServerName site2.mydomain.de
    ServerAlias www.site2.mydomain.de

DocumentRoot /home/customer1/domains/site2.mydomain.de/public_html

ErrorLog /var/log/virtualmin/site2.mydomain.de_error_log
LogLevel warn
CustomLog /var/log/virtualmin/site2.mydomain.de_access_log combined

ScriptAlias /cgi-bin/ /home/customer1/domains/site2.mydomain.de/cgi-bin/

DirectoryIndex index.html index.htm index.php index.php4 index.php5

<Directory /home/customer1/domains/site2.mydomain.de/public_html>

Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

AddType application/x-httpd-php .php

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/customer1/domains/site2.mydomain.de/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/customer1/domains/site2.mydomain.de/fcgi-bin/php5.fcgi .php5

</Directory>

<Directory /home/customer1/domains/site2.mydomain.de/cgi-bin>

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

</Directory>

<IfModule mod_rewrite.c>

RewriteEngine On

# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^site2.mydomain.de
RewriteRule ^/(.*)$ http://site2.mydomain.de/$1 [R=301,NE,L]

# Redirect 301 to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,NE,L]

</IfModule>

RemoveHandler .php
RemoveHandler .php5

FcgidMaxRequestLen 1073741824

<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>

<Location /git>

DAV on

AuthType Basic
AuthUserFile /home/customer1/domains/site2.mydomain.de/etc/git.basic.passwd

Require valid-user
Satisfy All


RewriteEngine off

AddHandler cgi-script .cgi

</Location>

</VirtualHost>

<VirtualHost 123.456.789.0:443 [a123:b456:c789:de0f::2]:443>

SuexecUserGroup "#1000" "#1000"

ServerName site2.mydomain.de
    ServerAlias www.site2.mydomain.de

DocumentRoot /home/customer1/domains/site2.mydomain.de/public_html

ErrorLog /var/log/virtualmin/site2.mydomain.de_error_log
LogLevel warn
CustomLog /var/log/virtualmin/site2.mydomain.de_access_log combined

ScriptAlias /cgi-bin/ /home/customer1/domains/site2.mydomain.de/cgi-bin/

DirectoryIndex index.html index.htm index.php index.php4 index.php5

<Directory /home/customer1/domains/site2.mydomain.de/public_html>

Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

Require all granted

AddType application/x-httpd-php .php

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/customer1/domains/site2.mydomain.de/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/customer1/domains/site2.mydomain.de/fcgi-bin/php5.fcgi .php5

</Directory>
<Directory /home/customer1/domains/site2.mydomain.de/cgi-bin>

allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted

</Directory>

SSLEngine on
SSLProtocol           all -SSLv2 -SSLv3
SSLCipherSuite         ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /home/customer1/domains/site2.mydomain.de/ssl.cert
SSLCertificateKeyFile /home/customer1/domains/site2.mydomain.de/ssl.key

RequestHeader set X-Forwarded-Proto "https"

<IfModule mod_rewrite.c>
RewriteEngine On

# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^site2.mydomain.de
RewriteRule ^/(.*)$ https://site2.mydomain.de/$1 [R=301,NE,L]
</IfModule>

RemoveHandler .php
RemoveHandler .php5

FcgidMaxRequestLen 1073741824

<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>

<Location "/web/database" >
Order deny,allow
Deny from all
Allow from 61.109.73.200 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>

<Location "/website/info" >
Order deny,allow
Deny from all
Allow from 61.109.73.200 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>

<Location /git>

DAV on
AuthType Basic
AuthUserFile /home/customer1/domains/site2.mydomain.de/etc/git.basic.passwd
Require valid-user
Satisfy All

RewriteEngine off

AddHandler cgi-script .cgi

</Location>

# Comment to disable proxy
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /longpolling/        http://localhost:8072/longpolling/ retry=0
ProxyPassReverse /longpolling/ http://localhost:8072/longpolling/ retry=0
ProxyPass /                    http://localhost:8069/ retry=0
ProxyPassReverse /             http://localhost:8069/ retry=0

</VirtualHost>

============= // =============

In that example also SSL Certificates get used and some stuff gets enabled by only certain IP addresses - you can simply uncomment those parts if not needed and of course change those IP addresses to yours/the customers

If you have one time setup that stuff it is quite easily to multiply the script (copy/paste) and than apply only those settings which change from site to site to each new multiple website you are having (search and replace) or even an automated script which is doing that for you (and/or for your customers)

============= // =============

Don't forget to restart apache2 i.e. on Ubuntu with 

service apache2 restart

to apply the changes.

============= // ============

in etc/odoo/mydomain-server.conf

you should have something like:

------
[options]
; This is the password that allows database operations:
admin_passwd = My123/456PassW.V9
db_host = False
db_port = False
db_password = False
db_user = myDBuser

# Ports to use
xmlrpc_port = 8069
longpolling_port = 8072

# Workers and timeouts
workers = 4
limit_time_real = 3600
limit_time_cpu = 3600

# Is it behind a HTTP reverse proxy?
proxy_mode = 1

# DB filtering for multi-site instances
# Example: dbfilter=^%d$
# %d = hostname

#dbfilter=^%h$

# Logfile
logfile = /var/log/odoo/customer1-server.log

# Addons Path
addons_path=/home/customer1/customer1-server/addons,/home/customer1/customer1-custom/addons,/home/customer1/customer1-custom/debranding,/home/customer1/customer1-custom/knowledge,/home/customer1/customer1-custom/project,/home/customer1/customer1-custom/reports,/home/customer1/customer1-custom/web,/home/customer1/customer1-custom/website

========== // ==========

Those addons paths shown here are how the customer/agency likes to have his modules sorted, you should insert your own paths here. They have setup groups i.e. for debranding which makes it easier for them to update those modules on a regular base i.e. from their github and also which makes it easier for them to take one of those working module groups from one site to another site.

===========  //  =========

in etc/init.d you need to enter your 

customer1-server file

which might look like that:
----

# Description: ODOO Business Applications
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/home/customer1/customer1-server/openerp-server
NAME=customer1-server
DESC=customer1-server

# Specify the user name (Default: odoo).
USER=customer1

# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/odoo/customer1-server.conf"

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}

case "${1}" in
start)
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
echo "${NAME}."
;;

restart|force-reload)
echo -n "Restarting ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
sleep 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;

esac
exit 0

============ // =============

don't forget to set the correct permissions to those files and the correct owners as well as check if all paths and passwords are the correct ones.

If everything is fine you should be able to run your multiple sites in one Odoo after restarting also the Odoo webserver.

i.e. on Ubuntu with

service customer1-server restart


=========== // ==============

In Odoo itself of course you need to configure those both sites like already described, so I won't repeat that here.

With kind regards,
Mit freundlichen Grüßen,
Con un cordial saludo,
Cordialement,
с сердечным приветом,
เรื่องที่เกี่ยวกับชนิด,
與親切的問候,

 ANDI BECKER

CEO/General Manager LisAndi Co., Ltd.

--------------------------------------------------

LisAndi Co. Ltd., Phuket, Thailand (lisandi.com)
15/21 M.2 Viset Road, Rawai, Muang, Phuket, Thailand 83130

Mobile: +66 (0)81 606 3378
VoIP:   +49 (0)711 50 88788 50
Fax:     +49 (0)711 50 88788 50
Skype:          lisandi
Facebook:     andibecker
Google Talk/Facetime/eMail:  andi@lisandi.com

--------------------------------------------------


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe