如何快速部署一套 odoo 应用?使用 docker 快速建站!
-
新建 docker-compose.yml
version: '2' services: web: image: odoo:14.0 depends_on: - db ports: - "8069:8069" volumes: - odoo-web-data:/var/lib/odoo - ./config:/etc/odoo - ./addons:/mnt/extra-addons db: image: postgres:10 environment: - POSTGRES_DB=postgres - POSTGRES_PASSWORD=odoo - POSTGRES_USER=odoo - PGDATA=/var/lib/postgresql/data/pgdata volumes: - odoo-db-data:/var/lib/postgresql/data/pgdata volumes: odoo-web-data: odoo-db-data:
-
启动 docker
docker-compose up -d
-
打开浏览器 http://localhost:8069
-
使用 Apache HTTPD 反向代理
<VirtualHost *:80> DocumentRoot "/var/www/html/odoo.cn" ServerName www.odoo.cn RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] <Directory "/var/www/html/odoo.cn"> allow from all Options None Require all granted </Directory> </VirtualHost> <VirtualHost *:443> DocumentRoot "/var/www/html/odoo.cn" ServerName www.odoo.cn RewriteEngine on <Directory "/var/www/html/odoo.cn"> allow from all Options FollowSymLinks Require all granted AllowOverride All </Directory> SSLEngine on SSLCertificateFile /etc/httpd/conf.d/www.odoo.cn_public.crt SSLCertificateKeyFile /etc/httpd/conf.d/www.odoo.cn.key SSLCertificateChainFile /etc/httpd/conf.d/www.odoo.cn_chain.crt ProxyRequests Off ProxyPreserveHost On ProxyPass / http://127.0.0.1:8069/ ProxyPassReverse / http://127.0.0.1:8069/ ProxyErrorOverride off </VirtualHost>
-
打开浏览器 http://www.odoo.cn ,直接访问域名,注意要使用 https 需申请域名 ssl 证书