← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] How to run DHIS2 & iHRIS on the same Server

 

Dear Bob,
I didn't actually uninstall nginx. This is what i did:

1. I ran a2enmod module
2. nano /etc/apache2/sites-enabled/000-default.conf
3. I define a proxy virtual host using mod_virtualhost

<VirtualHost *:*>
    ProxyPreserveHost On

    # Servers to proxy the connection, or;
    # List of application servers:
    # Usage:
    ProxyPass / http://[IP Addr.]:[80]/hris
    ProxyPassReverse / http://[IP Addr.]:[8080]/dhis
    # Example:
    ProxyPass / http://0.0.0.0:8080/
    ProxyPassReverse / http://0.0.0.0:8080/

    ServerName localhost
</VirtualHost>

service apache2 restart

Then i test both application where running. Please let me know if it
makes sense.
NOTE: 0.0.0.0 was replaced by the local server IP

On 7/3/15, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
> Hi Gerald
>
> So you are using apache as reverse proxy and uninstalled nginx.  That is
> fine.
>
> There is not much to choose between the two.  Using nginx as reverse
> proxy in front of apache is very light though obviously costs a
> little.  On the other hand apache is a slightly heavier reverse proxy
> than nginx so also costs a little.
>
> The important thing is to have one proxy rather than accessing
> different urls directly through different ports.  For one thing it
> allows you to share the benefits of your your ssl certificate.  Also
> it gives you some flexibility, for example if one day you get yourself
> a separate server to run dhis you just reconfigure the proxy so there
> is no change for users.
>
> Cheers
> Bob
>
> On 3 July 2015 at 09:01, gerald thomas <gerald17006@xxxxxxxxx> wrote:
>> Dear Jason/Bob,
>> I already choose the first option Bob gave and both of the
>> applications are up and running.
>> Please i can i know my disadvantages of doing this because that is the
>> only server I have right now and i am sure it is doing a lot of
>> processes.
>>
>> On 7/3/15, Jason Pickering <jason.p.pickering@xxxxxxxxx> wrote:
>>> Hi Gerald,
>>>
>>> So part of the problem with dhis2-tools is that it makes some
>>> assumptions
>>> about your setup. Namely, that you do not really have anything else
>>> running
>>> on the machine other than DHIS2. In your case, you have IHRIS, which is
>>> a
>>> PHP application, and it is being served by the Apache HTTP server.
>>>
>>> The link which I sent to you, describes how to use the Apache HTTP as a
>>> reverse proxy, which in your case, would seem to be simpler. Usually, we
>>> would use Nginx as a reverse proxy because it is faster and has a much
>>> smaller memory foot print than Apache HTTP. But with your setup, you
>>> already have Apache HTTP installed, so it would seem simpler (to me) to
>>> simply use that as your reverse proxy for DHIS2 as well, rather than
>>> having
>>> both Apache HTTP and NGINX running on the same machine.
>>>
>>> As Bob just mailed, there are different ways of doing it, each with
>>> their
>>> advantages and disadvantages, but Apache is fully capable of serving as
>>> a
>>> reverse proxy for DHIS2, so it would just seem simpler to use it.
>>>
>>> Regards,
>>> Jason
>>>
>>>
>>> On Fri, Jul 3, 2015 at 8:45 AM, gerald thomas <gerald17006@xxxxxxxxx>
>>> wrote:
>>>
>>>> Dear Jason,
>>>> I am sure both the Apache and Nginx needs to run together but after
>>>> looking at the manuals i found out that the normal installation of
>>>> nginx is different from the way "dhis2-tool" runs it installation.
>>>> I am a bit confuse where i should start.
>>>>
>>>>
>>>> On 7/3/15, Jason Pickering <jason.p.pickering@xxxxxxxxx> wrote:
>>>> > Hi Gerald,
>>>> >
>>>> > Not to confuse stuff too much, but if you already have Apache
>>>> > running,
>>>> you
>>>> > could also consider to use that as a reverse proxy for DHIS2 as well.
>>>> This
>>>> > is described here
>>>> >
>>>> >
>>>> https://www.dhis2.org/doc/snapshot/en/implementer/html/ch08s03.html#d5e648
>>>> >
>>>> > That way, you would not need both Apache and Nginx running, although
>>>> there
>>>> > could be reasons why you might want that as seen from the article
>>>> > which
>>>> > Halvdan shared.
>>>> >
>>>> > Regards,
>>>> > Jason
>>>> >
>>>> >
>>>> > On Fri, Jul 3, 2015 at 8:05 AM, gerald thomas <gerald17006@xxxxxxxxx>
>>>> > wrote:
>>>> >
>>>> >> Dear all,
>>>> >> Thanks for your responses I will look at the nginx configuration
>>>> >> file
>>>> and
>>>> >> get back to this forum.
>>>> >>
>>>> >> Regards,
>>>> >> Gerald
>>>> >> On 3 Jul 2015 05:57, "Knut Staring" <knutst@xxxxxxxxx> wrote:
>>>> >>
>>>> >>> As Halvdan implies, you probably now havr both nginx and apache
>>>> >>> running
>>>> >>> on the same port (80) and thus blocking each other. You probably no
>>>> >>> longer
>>>> >>> need Apache now that you have nginx, but need to point nginx to the
>>>> >>> ihris
>>>> >>> installation.
>>>> >>> Knut
>>>> >>> On Jul 2, 2015 11:40 PM, "Halvdan Grelland" <halvdanhg@xxxxxxxxx>
>>>> wrote:
>>>> >>>
>>>> >>>> I presume you've set up DHIS2 with nginx or Apache (as per usual
>>>> >>>> with
>>>> >>>> the standard dhis2-tools setup).
>>>> >>>>
>>>> >>>> What you need to do is configure nginx (presuming that's what
>>>> >>>> you're
>>>> >>>> using) with a location for both, /dhis and /hris respectively. The
>>>> >>>> /dhis
>>>> >>>> location should be configured already, evident by what you're
>>>> >>>> saying,
>>>> >>>> iHRIS
>>>> >>>> i'm not familiar with, but a quick googling tells me it uses
>>>> >>>> apache,
>>>> >>>> meaning you'd probably want to set up nginx as a common front-end
>>>> >>>> for
>>>> >>>> both.
>>>> >>>> I found this link
>>>> >>>> <
>>>> https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache
>>>> >
>>>> >>>> but
>>>> >>>> cannot really vouch for its content (I only skimmed through it).
>>>> >>>>
>>>> >>>> The details you should be able to find online as there are vast
>>>> >>>> resources on configuring both nginx and Apache. It's not really a
>>>> DHIS2
>>>> >>>> or
>>>> >>>> iHRIS specific case.
>>>> >>>>
>>>> >>>> Best of luck!
>>>> >>>>
>>>> >>>> Halvdan,
>>>> >>>> DHIS2 developer
>>>> >>>>
>>>> >>>> 2015-07-02 23:13 GMT+02:00 gerald thomas <gerald17006@xxxxxxxxx>:
>>>> >>>>
>>>> >>>>> Dear All,
>>>> >>>>>
>>>> >>>>> My DHIS2 was running on the old installation method which means
>>>> >>>>> was
>>>> >>>>> accessing it using:
>>>> >>>>> http://localhost:8080/dhis.
>>>> >>>>>
>>>> >>>>> Now i had changed the method of installation using the dhis2-tool
>>>> >>>>> method and i can access it using:
>>>> >>>>> http://localhost/dhis
>>>> >>>>>
>>>> >>>>> Now my issues:
>>>> >>>>> This server was running Integrated Human Resource Information
>>>> >>>>> System
>>>> >>>>> (iHRIS) and was being access using
>>>> >>>>> http://localhost/hris/login
>>>> >>>>>
>>>> >>>>> Currently, when the instance of dhis2 is running iHRIS will goes
>>>> >>>>> down
>>>> >>>>> and when dhis2 goes down iHRIS will work fine.
>>>> >>>>>
>>>> >>>>> Please i need both to run in parallel can anyone help me how i
>>>> >>>>> can
>>>> >>>>> do
>>>> >>>>> it.
>>>> >>>>>
>>>> >>>>> Kindly note that
>>>> >>>>> iHRIS (Database is MySQL)
>>>> >>>>> DHIS2 (Database is PostgreSQL)
>>>> >>>>>
>>>> >>>>> --
>>>> >>>>> Regards,
>>>> >>>>>
>>>> >>>>> Gerald
>>>> >>>>>
>>>> >>>>> _______________________________________________
>>>> >>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> >>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> >>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> >>>>> More help   : https://help.launchpad.net/ListHelp
>>>> >>>>>
>>>> >>>>
>>>> >>>>
>>>> >>>> _______________________________________________
>>>> >>>> Mailing list: https://launchpad.net/~dhis2-users
>>>> >>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>> >>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>> >>>> More help   : https://help.launchpad.net/ListHelp
>>>> >>>>
>>>> >>>>
>>>> >> _______________________________________________
>>>> >> Mailing list: https://launchpad.net/~dhis2-users
>>>> >> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>> >> Unsubscribe : https://launchpad.net/~dhis2-users
>>>> >> More help   : https://help.launchpad.net/ListHelp
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>> > --
>>>> > Jason P. Pickering
>>>> > email: jason.p.pickering@xxxxxxxxx
>>>> > tel:+46764147049
>>>> >
>>>>
>>>>
>>>> --
>>>> Regards,
>>>>
>>>> Gerald
>>>>
>>>
>>>
>>>
>>> --
>>> Jason P. Pickering
>>> email: jason.p.pickering@xxxxxxxxx
>>> tel:+46764147049
>>>
>>
>>
>> --
>> Regards,
>>
>> Gerald
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>


-- 
Regards,

Gerald


Follow ups

References