Multi domains to multi instances - vps

I want to host two odoo instances or database (?), in order to be sure that everything is separated, on a rented VPS for my wife firm and mine.
We both have a domain name.
I need the following thing :
- Browsing www.mywifedomainname.tld leads to my wife's odoo
- Browsing www.myowndomainname.tld leads to my odoo instance
Can you advise me what to do :
1 - Do I need a reverse proxy to have multi domains leading to multi instances ?
2 - In case the reverse proxy is the solution, do you know a good tutorial on how to setup it on Debian (or another distribution) ?
3 - Should I have 2 instances of Odoo or only 2 databases ?
Thanks for you interest :)

yes i have realized this on my server.
to achieve that goal I have tested two ways. It's up to you wich one is better to feet on your needs
1 method is odoo+wsgi+appache2
2 method is odoo+nginx+SSL
both cases required the proxy reverse.
so lest go on.
I assume that you know how to install odoo and postgress
mandatory requirement:
you should have hardware that can handle odoo postgress and webserver for more than one instance. As of every instance of odoo creates it's own processes. My server (6 core CPU, 3 gb Ram, and i have cpu load around 5% and RAM for 40%, i have 6 different instances rub=ning on this server with different domain names)
for each instance you should have different user created for odoo and for PostgreSQL
in case of using first method odoo+wsgi+appach you don't ned to configure openerp-server.conf file and sturtuo script as of we gonna use openerp-wsgi.py file as a configuration and the appache to sturt odoo.
/YOUR_ODOO1_PATH/openerp-wsgi.py modification with your data:
conf['addons_path'] = 'LINK TO YOUR ODOO1 ADDONS FULL PATH FROM THE ROOT'
admin_passwd = 'ODOO1 MASTR ADMIN PASSWORD'
conf['db_user'] = 'ODOO1_POSTGRESQL_USER_NAME'
conf['db_password'] = 'ODOO1_POSTGRESQL_USER_PASSWORD'
bind = '0.0.0.0:8070'
pidfile = '.gunicorn.pid'
workers = 4
timeout = 240
max_requests = 2000
conf['logfile'] = '/var/log/ODOO1/wsgi-pyton.log'
THAT WILL RUN YOUR ODOO1 instance on port 8070
for each instance you should use DIFFERENT PORT
now it is time to configure appache server:
I assume that you have installed apache server
but in any case, to do that use
sudo apt-get install apache2
and for mod WSGI
sudo apt-get install libapache2-mod-wsgi
Enable required apache modules:
sudo a2enmod proxy_http headers rewrite wsgi
If the system miss some of them you should install this modules first then enable them. More you will find in the Apache website.
Create Configuration file in apache for reverse proxy for site odoo1.com:
sudo nano /etc/apache2/sites-available/odoo1.conf
<VirtualHost *:80>
ServerName odoo1.com
ErrorLog /var/log/odoo1/openerp-error.log
CustomLog /var/log/odoo1/openerp-access.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / **odoo1_full_URL**
ProxyPassReverse / **odoo1_full_URL**
ProxyVia On
LogLevel warn
</VirtualHost>
odoo1_full_URL replace with http : // odoo1.com: 8070 (for me it is not allowed to post more than 2 url, that way i have write in this way without spaces)
5. Create Site Configuration file to run WSGI script
sudo nano /etc/apache2/site-available/odoo1-wsgi.conf
With following content
<VirtualHost *:80>
ServerName odoo1.com
WSGIScriptAlias / /YOUR_ODOO1_PATH/openerp-wsgi.py
WSGIDaemonProcess oe user=ODOO1_USER group=ODOO1_USER processes=2 pythonpath=/YOUR_ODOO1_Path/ display-name=apache-ODOO1USER
WSGIProcessGroup oe
ErrorLog /var/log/ODOO1/odoo1-wsgi-error.log
CustomLog /var/log/ODOO1/odoo1-wsgi-access.log combined
<Directory /YOUR_ODOO1_PATH>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
finaly enable your odoo1 and odoo1-wsgi configuration sites and restart apache server
sudo a2ensite odoo1-wsgi.conf odoo1.conf
sudo service apache2 restart
that's all by typing in the url the odoo1.com you will be able to see your database without port number in the address bar.
do the same for any other instance and enjoy.
Let me know if you will have questions.
teh second method I will explain in my next post.

Related

easyphp / apache not able to connect to my dokuwiki with machines (virtuals and not virtual ones) on the same lan

I'm trying to setup a dokuwiki installed on an easyphp based on a windows distribution.
Nothing fancy so far
I can use the doku on my machine with the url http://192.168.2.14:888
Issue is I cannot access the wiki from another machine , virtual or not virtual one.
I thought it was an issue with the httpd.conf. I amended both part (see below)
<Directory "C:/Program Files (x86)/EasyPHP-Webserver-14.1b2/binaries/httpserver/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
And also the second part
<Directory "C:/Program Files (x86)/EasyPHP-Webserver-14.1b2/modules">
Options FollowSymLinks Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I restarted the service and yet I still could not connect through any web browser with machines installed on my lan.
So I thought maybe it has something to do with the port
I did a netstat -a -n on the machine where I installed the easy php.
It seems to be listenning
I can ping 192.168.2.14 888 yet when I'm doing a telnet 192.168.2.14 888, I cannot connect.
So I disabled my firewall and still I cannot connect to my wiki through the web browser or telnet 192.168.2.14 888 it.
I do not have any more clues to where look at.
Any leads that will help me solve this issue , are more than welcomed.
Thanks
Update : I've done these steps since talking to Omar yesterday eve
Change to Listen 888
Change Order allow,deny Allow from all to just Require all granted
I hate to say it but using easy php , for a prototype usable by more than one machine on the same lan, is a real pain.
This is my way to have a quick dokuwiki prototype usable by all the availables machine on your lan:
Install a linux virtual machine on your laptop (ubuntu server in my case)
Install apache2, php5 & libapache2-mod-php5
Restart the apache2 service
Copy your Doku folder in the folder html
And done. You can use your dokuwiki
Forget about easyphp and the likes

Tomcat 7 - Ubuntu : create a domain name instead of IP:8080/appName

I have deployed my webapp on an Ubuntu server in my company.
the war is in the folder :
/var/lib/tomcat7/webapps
Tomcat7 has deployed the archive in the folder
/var/lib/tomcat7/webapps/bioApp/
My problem is that to access the web app I need to type the url :
http://IP_OF_SERVER:8080/bioApp
I would like the users to type :
www.bioApp.com
I have tried many solutions (modifying server.xml, hosts file, etc).
None of them work.
If anyone has a working solution...
Thanks
The first thing you need is a local dns server in your company. In your dns server add a rule to route your ip (IP_OF_SERVER) to the local domain name
IP_OF_SERVER bioApp.com
If you had an apache server, you must add a virtualhost in your conf file (See this page for more information)
<VirtualHost *:80>
ServerName bioApp.com
ProxyPass / http://IP_OF_SERVER:8080/bioApp
ProxyPassReverse / http://IP_OF_SERVER:8080/bioAppr
</VirtualHost>
If you don't have a apache server, you can change your tomcat listen port.(See this post).

How to point HostGator domain to EC2 AWS

We have an existing domain name
(ex. webdev.com)
located in hostgator and we have a server in AWS. We wanted to use the domain name that we bought from hostgator
(webdev.com)
in our AWS server.
What we did was, in hostgator we created a DNS (project1.webdev.com) and the address is pointing to our AWS server(ex 150.12.1.0). In our AWS, we deploy the project1 under port 4000.
Now if we access the
project1.webdev.com
we end up to the default apache page. How could we route it to our port 4000 so that everytime we access project1.webdev.com it pointed to our
150.12.1.0:4000
project.
here is our virtual host config:
<VirtualHost *:4000>
ServerName project1.webdev.com
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/var/www/html/project1/web"
<Directory "/var/www/html/project1/web">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/4000-error_log
CustomLog ${APACHE_LOG_DIR}/4000-access_log common
We have looked for several information but we did not find any possible solution. Looking forward for your help.
Thanks
You're confusing DNS, which has to do with IP addressing, with ports, which have nothing to do with DNS. DNS only deals with converting between human-readable names and IP addresses. DNS does not provide any sort of provision to perform a task like "when a user wants to make an HTTP request use port 4000 instead of port 80".
If your service is listening on port 4000 but you're using the HTTP protocol (which always uses port 80 by default) then you will need to deal with this in one of the following ways:
Require all URL's to explicitly specify port 4000, for example: http://project1.webdev.com:4000
Change your VirtualHost definition to listen on port 80 instead of 4000
Add a new VirtualHost definition in Apache for port 80 that proxies all requests to port 4000
Sharing you the solution we made. Thanks to #Bruce for helping us out. As what he suggested in the comments above, we will create a virtual host porting to 80(which is the default of apache). Then we will route the port 80 to our specific project.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName project1.webdev.com
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/html/project1/web"
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/project1-error.log
CustomLog ${APACHE_LOG_DIR}/project1-access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
If you have multiple DNS just create another instance of port 80 and route to the project.
Make sure that the Domain name in HostGator matches with the ServerName you created in the virtual host.

How To Set Up Apache Virtual Hosts on XAMPP (Windows) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
How To Set Up Apache Virtual Hosts on XAMPP (Windows)
##Full guideline to make VHOST (Virtual Host) on XAMPP/WAMP
Note: To start with, the only difference for this guideline, between XAMPP and WAMP or other Apache packages for Windows, is question where those packages are installed on your computer.
Introduction: vhost (virtual host) is a great solution if you intend to develop many independent project in php and keep them isolated from each others, like:
Project 1 is based on php and has local url address php.localhost
Project 2 is a Laravel project with url laravel.localhost
Project 3 is a Codeigniter with url codeigniter.localhost
Project 4 is a WordPress with url wordpress.localhost
You are expected to have installed the latest version of XAMPP/WAMP. Btw, in my case, I have only installed Apache and MySQL.
*Note: By default, most web servers will uses port 80 as default port, in some situation if you have another web server installed like (Microsoft IIS), it uses port 80 as well OR in other cases SKYPE does also some times use port 80 like it is the case for some in Windows 8/10 for some users, in that case you can do two thing’s
Change your Apache port to port 8080, 8081 etc. or some other free ports (note: 8080 can some times also give some problems)
OR Change your others software/IIS port and keep Apache to default port 80 in case of Skype, just kill the Skype app and restart it after installing Apache on port 80, Skype will automatically get new port.
I have chosen to change my Apache to port 8080.
Note:
For next section, we need to use text editor like notepad or regular IDE. I used sublime text editor.
If you keep Apache to default port 80, skip this part and move on to Virtual hosts
Change XAMPP/WAMP port (only if necessary)
if left default, then jump to Setting virtual host
Step 1. Edit httpd.conf
Click on Config -> Apache (httpd.conf)
Or you find the file here C:\XAMPP\apache\conf\httpd.conf, C:\XAMPP\apache2\conf\httpd.conf, C:\Bitnami\wampstack\apache\conf\httpd.conf or C:\Bitnami\wampstack\apache2\conf\httpd.conf or similar location.
Change the line with
Listen 80
To 8080 or other, free ports.
Listen 8080
While we have httpd.conf file open we need to ensure that httpd-vhosts.conf is included:
Include conf/extra/httpd-vhosts.conf
Virtual hosts
Note: By default server documents are locate on C:\XAMPP\htdocs or C:\Bitnami\wampstack\apache2\htdocs that’s fine if you have only one project or many small test files. However, if you need to develop many projects then it suggested separating them by virtual host, as mentioned earlier.
Step 2. Setting Virtual host
Create a folder for your projects; I have create one in c:\vhost you can call it projects etc.
In c:\vhost folder we create a sub-folder domain1 or project1 or any other, it is up to you (c:\vhost\project1)
Open httpd-vhosts.conf file C:\XAMPP\apache\conf\extra\httpd-vhosts.conf Add following code in line depending on how many vhost you want to create:
<Directory C:/vhost>
AllowOverride All
Require all granted
</Directory>
#this is the default address of XAMPP
<VirtualHost *:8080>
DocumentRoot "C:/XAMPP/htdocs/"
ServerName localhost
</VirtualHost>
#this is the first vhost address in XAMPP
<VirtualHost *:8080>
DocumentRoot "C:/vhost/project1/"
ServerName php.localhost
SetEnv NS_ENV variable_value
</VirtualHost>
#this is the second vhost address in XAMPP for project like Laravel
<VirtualHost *:8080>
DocumentRoot "C:/vhost/Laravel-Blog/public"
ServerName laravel.localhost
</VirtualHost>
etc
Note: If you work on Laravel projects you can create unlimited Laravel projects as well as other frameworks like codeigniter, Yii, etc., the point is to
have your Laravel project/s on c:\vhost\laravel1,
c:\vhost\laravel2 etc and make c:\vhost\laravel1\public as
DocumentRoot etc as showed before. Each Laravel project will have own
VirtualHost URL.
Save and close the file
Some additional information and notes:
If port is remain default 80 then the URL address will be localhost
If port is remain default 80 then the the VirtualHost tag should be changed to <VirtualHost *:80>
If port is changed to 8080, the URL address will be localhost:8080
And the vhost URL address could look like this project1.localhost:8080 etc
You can add unlimited projects and virtual host like this way.
We are not ready yet, read more.
Step 3. Edit Windows Host file
Stop Apache and MySQL services from XAMPP/WAMP.
Open hosts file in C:\windows\system32\drivers\etc
you need Administrator privilege to edit the file.
I suggest to edit the file directly with Sublime text editor.
Add 127.0.0.1 project1.localhost at the end of the file, Save and close the file.
127.0.0.1 localhost
127.0.0.1 php.localhost
127.0.0.1 laravel.localhost
127.0.0.1 codeigniter.localhost
127.0.0.1 wordpress.localhost
127.0.0.1 laravel2.localhost
etc. those are just examples
save the file
Final Step.
Start/Re-start your Apache and MySQL again.
**Addition (Suggestion)**
Note: Under you development process you might face problem having cache on, because you can risk updating some thing in Laravel and it won't appear in your browser. Therefore you might need to disable php cache under development process in your local environment.
Open file php.ini under php folder in your Apache (XAMPP or WAMP) folder and
change opcache.enable to 0 so it looks like this:
[opcache]
zend_extension=php_opcache.dll
; Determines if Zend OPCache is enabled
opcache.enable=0
Addition (Alternative solution)
Important: The following solution is not suitable to test Restful Api, canvas, heavy solutions, etc.it might give you some headaches, I would suggest virtual host solution with port 80 as default.
It is possible to deploy temporary Virtual Server with out necessarily configuring XAMPP/WAMP Virtual Host, start CMD console and run following php command:
php -S localhost:8001 -t c:\vhost\Laravel-Project\public
Port 8001 can be change to any available port number and be sure not conflicting with other software ports.
c:\vhost\Laravel... path should be changed to whatever your project path.
It is possible to start multiple servers but should have different port numbers.
In your browser you need only to write
http://localhost:8001/
Note on 403 Access forbidden error
If you get a 403 Access forbidden error when you browse to your site, you may need to add this to your httpd.conf file:
<Directory path_to_dir>
AllowOverride none
Require all granted
</Directory>
You can make your localhost to point to different folders on different port numbers. Follow these simple steps:
Step 1: Make your apache to listen to multiple ports. Go to C:\xampp\apache\conf\httpd.conf and search for the key word Listen you can see something like this Listen 80. Now tell your apache to listen to multiple ports, replace that with below content
Listen 80
Listen 8001
Listen 8002
Step 2: Now go to “C:\xampp\apache\conf\extra\httpd-vhosts.conf”, this is the actual player. At the end of the file you can specify something like this below:
DocumentRoot "C:/xampp/htdocs/project1"
ServerName localhost:8001
DocumentRoot "C:/xampp/htdocs/project2"
ServerName localhost:8002
Which tells your apache to take different folders on hitting different port numbers. That is when you hit localhost:8001/ it will take the contents from project1, similarly localhost:8002/ will point to your project2 folder.
By doing this we and run 2 different sites on our local machine.
Note: You need to restart your apache whenever you change something in httpd.conf or httpd-vhosts.conf.
Virtual Host create
C:\xampp\apache\conf\extra
Open httpd-vhost file then
Add
DocumentRoot "C:\xampp\htdocs\project\timegrid\public"
ServerName mytimegrid.me(ur choice)
C:\Windows\System32\drivers\etc
Open hosts file then add 127.0.0.1 mytimegrid.me(Your Domain Name)
N.B. you first open your editor(notepad etc....) as Run As Administrator mode otherwise you can not save these files. ok.
First of all, open your Notepad as an Administrator and
then click on file > open. Then go to your window driver now search for system32 folder and then search for drivers folder and then the etc folder.
Now you'll see a folder of empty files, so don't worry to see Text Documents (*.txt) at the bottom. Change the view to all files and then you will see the vhost file.
Open and enjoy!

Joomla installation - access denied 403

I can already tell that I'm probably doing something hideously wrong, but I just can't get anything to work or even acknowledge me.
I have a working Joomla 1.5 site on a localhost setup on a lamp stack with Ubuntu (newest everything). I am working on upgrading the site to a newer version. I've followed the steps on the joomla site, which are simple, just extract the zip file on the server, just like I did for 1.5, and then go to the site. I am doing this in a subdirectory I've called upgrade, physically located at /var/www/upgrade/ and when i try to go to localhost/upgrade, I get a "FORBIDDEN" 403. I tried localhost/upgrade/administrator, localhost/index.php, localhost/administrator/index.php, and even localhost/installation/index.php and nothing works.
I went into the installation/ dir and made and saved the configuration.php and .htaccess in upgrade/ to no avail and as a last resort I even did a chmod -R 777 * (yeah I know), restarted apache but nothing changes.
Just to see if it was the install, I dl'd Joomla 3.2 and got the exact same result. All the while my 1.5 site is still happily working.
What am I doing wrong?
You want to setup a Virtual host for the new site. You can do this with either a port or a host.
So if you have your Apache conf setup correctly you can add another Virtual host with something along the lines of.
<VirtualHost *:80>
DocumentRoot /var/www/upgrade
ServerName upgrade.local
</VirtualHost>
You'll also need to add a hosts entry which points to your localhost/IP. Its worth checking out a good guide on setting all this up as theres quite a few steps. The Ubuntu one is pretty good if your on that Distro.
https://help.ubuntu.com/community/ApacheMySQLPHP
Specifically the bit on Virtual Hosts
ServerName means that the server will listen for hosts with that name. So, if you have a host such as upgrade.local pointing to your server then the VirtualHost entry will pick that up and point it to the directory /var/www/upgrade.
In order to point a local host to your server you need to add it to your machines hosts file. To add a new host like upgrade.local (you can call it whatever you want) you edit /etc/hosts and set the IP it points to.
127.0.0.1 upgrade.local
ServerName is not mandatory but I find it better as its easier to organise your local host sites.
The alternative is to do it by port (which means you can avoid having to change the hosts file). You need to listen for the port in this case.
Listen 3000
<VirtualHost *:3000>
DocumentRoot /var/www/upgrade
</VirtualHost>

Resources