11 Replies Latest reply on Dec 21, 2009 7:40 AM by Oleksii Vavilkin

    set site to virtualhost

    Oleksii Vavilkin Newbie

      Hi everyone =)
      I'm trying to set the 'Site' I created to one of the JBoss virtual hosts.
      The default GateIn is set up to the #HOST/portal
      And any new site I create is linked to #HOST/portal/private/newsite
      I'd like to do next:
      myPortalHost.com -> #HOST/portal
      newsite.com -> #HOST/portal/private/newsite
      I've added a new virtual host to the jbossweb.sar/server.xml
      Could you please help me? Google search and GateIn documentation didn't help :(

      Thanks in advance!

        • 1. Re: set site to virtualhost
          Oleksii Vavilkin Newbie

          Guess Apache proxy will help.
          Though I hoped this feature is available in GateIn, like I did it with Jboss deploying projects to diferent virtual-hosts.

          • 2. Re: set site to virtualhost
            Oleksii Vavilkin Newbie

            Help is needed.

            I configured Apache2 with proxy and proxy_http

            Right now once I browse thc.org.ua I get to the right place (thc.org.ua:8080/portal/public/anthill) but the page displays text only :-/

            Could you please point me what the problem might be?

            tnx in advance.

            • 3. Re: set site to virtualhost
              rafael liu Newbie

              We usually use AJP protocol (mod_JK). In your case you probably aren't proxing jpg, gif and css.

               

              How's your httpd.conf?

              • 4. Re: set site to virtualhost
                Oleksii Vavilkin Newbie

                Hi rafael liu!

                Thanks for advice!

                The httpd.conf is default for gentoo once apache installed with proxy_http etc. modules. You can find it in the attach.

                I configure my proxy in virtual host. Here it is:

                 

                Listen 80

                NameVirtualHost *:80

                 

                <VirtualHost *:80>

                    ServerName anthill.homelinux.net

                    ServerAlias thc.org.ua

                    ProxyRequests Off

                    ProxyPreserveHost On

                 

                    RewriteEngine On

                    RewriteRule ^(.*)$ http://thc.org.ua:8080/portal/public/anthill$1 [P]

                 

                    <Proxy balancer://mycluster>

                        Order allow,deny

                        Allow from all

                        BalancerMember ajp://localhost:8080/portal/public/anthill route=node1

                    </Proxy>

                 

                    ProxyPass / balancer://mycluster/portal/public/anthill

                    ProxyPass /portal/resource/Default/web_BannerPortlet/Default/web_FooterPortlet/Default/web_NavigationPortlet/ !

                    ProxyPass /eXoResources/skin/ !

                    ProxyPassReverse / http://localhost:8080/portal/public/anthill

                    <Location /portal>

                        Order allow,deny

                        Allow from all

                    </Location>

                 

                </VirtualHost>

                 

                And I actually get these two exceptions refreshing the browser:

                15:03:50,353 ERROR [portal:ResourceRequestFilter] Could not render css /portal/pub

                lic/anthill/eXoResources/skin/Stylesheet-lt.css

                java.lang.NullPointerException

                        at org.exoplatform.portal.resource.SkinService.processCSSRecursively(SkinS

                ervice.java:437)

                 

                15:03:50,381 ERROR [portal:ResourceRequestFilter] Could not render css /portal/pub

                lic/anthill/portal/resource/Default/web_BannerPortlet/Default/web_FooterPortlet/De

                fault/web_NavigationPortlet/1260966989168-lt.css

                java.lang.NullPointerException

                        at org.exoplatform.portal.resource.SkinService.processCSSRecursively(SkinS

                ervice.java:437)

                 

                And here i from the apache log:

                95.215.216.69 - - [16/Dec/2009:15:18:00 +0200] "GET / HTTP/1.1" 200 42138

                95.215.216.69 - - [16/Dec/2009:15:18:06 +0200] "GET /eXoResources/skin/Stylesheet-

                lt.css HTTP/1.1" 404 948

                95.215.216.69 - - [16/Dec/2009:15:18:06 +0200] "GET /portal/resource/Default/web_B

                annerPortlet/Default/web_FooterPortlet/Default/web_NavigationPortlet/1260966989168

                -lt.css HTTP/1.1" 404 948

                 

                Thanks in advance!

                • 5. Re: set site to virtualhost
                  rafael liu Newbie

                  I didn't understand what you're trying to do.

                   

                  1. the balancer member shoudn't contain the context, only de host:port
                  2. you are using ajp protocol and connecting to 8080 (which usually is http)..
                  3. why are you blocking some proxies (using "!")?

                   

                  For proxing using AJP look at mod_proxy_ajp documentation, that should help you.

                  • 6. Re: set site to virtualhost
                    Oleksii Vavilkin Newbie

                    Oh, thanks! Is that realy so bad?

                    Actually I couldn't find a clue in the official documentation, thus I used some other sources.

                    So, first I configured mod_proxy as said in http://community.jboss.org/wiki/UsingModproxyWithJBoss

                    (At this moment I could see my portal, css was the only thing couldn't be displayed).

                    Then I found http://www.erenkrantz.com/oscon/OSCON%202006%20Apache%20mod_proxy.pdf

                    And it says, that mod_proxy could be used the same way as mod_jk, if you set ajp instead http.

                    And also it recommends to use

                    ProxyPass /path-to-css !

                    ProxyPass /path-to-img !

                    to get some static context like images and css. Seems like made mistakes, misunderstanding the mod_proxy.

                    Yes, I used google and read mans before asking such questions, but that didn't help much although...

                    I would be grateful if you advice me some nice manual, 'cause nothing what I read about mod_proxy wasn't transparent to my problem :-/

                    • 7. Re: set site to virtualhost
                      rafael liu Newbie

                      NP. Your source in JBoss wiki (http://community.jboss.org/wiki/UsingModproxyWithJBoss) is a good tutorial. You have to follow the title "Using mod_proxy with AJP", don't mix with other types of configurations there.

                       

                      Then post wheter you still have problems.

                      • 8. Re: set site to virtualhost
                        Oleksii Vavilkin Newbie

                        I followed the instructions. If everything done up to the tutorial, when I refresh the page I get the 503 error.

                         

                        Service Temporarily Unavailable

                        The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.


                        Apache Server at anthill.homelinux.net Port 80

                        and

                         

                        [Thu Dec 17 17:42:10 2009] [error] (70014)End of file found: ajp_ilink_receive() can't receive header

                        [Thu Dec 17 17:42:10 2009] [error] ajp_read_header: ajp_ilink_receive failed

                        [Thu Dec 17 17:42:10 2009] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (thc.org.ua)

                         

                         

                        in apache log.

                         

                        I googled this error but found only mailing lists with no concrete answer :-/

                        Though the "previous" result (when the page is displayed but no css could be loaded) is achieved by

                         

                            RewriteEngine On

                            RewriteRule ^(.*)$ http://thc.org.ua:8080/portal/public/anthill$1 [P]

                         

                        Even (!!!) if this is the only configuration in the vhost file! Thus all my previous achievements (like displaying the page without css) weren't about mod_proxy.

                        Oh, I tried to add a rewrite rule for css files, but nothing changed actually.

                         

                        I'm a little bit confused. Should I try to achieve my goal using RewriteEngine, mod_proxy, mod_proxy_ajp or mod_jk? So many solutions, guess should try them all just kidding... hope so.

                        • 9. Re: set site to virtualhost
                          Oleksii Vavilkin Newbie

                          I managed to do the same thing with mod_proxy as for mod_rewrite.

                          Right now in my virtual host configuration file:

                           

                              <Proxy balancer://mycluster>

                                  Order deny,allow

                                  Allow from all

                           

                                  BalancerMember http://thc.org.ua:8080/ route=node1

                                  #BalancerMember ajp://thc.org.ua:8080/

                              </Proxy>

                              ProxyPass /anthill balancer://mycluster/portal/public/anthill

                              ProxyPassReverse /anthill http://thc.org.ua:8080/portal/public/anthill

                               #ProxyPass /portal/public/anthill balancer://mycluster/portal/public/anthill

                              <Location / >

                                  Order deny,allow

                                  Allow from all

                              </Location>

                          The result is just the same as for RewriteRule. No css.
                          I couldn't do at least the same using ajp. And I've got a problem configuring jboss according to the manual you mentioned. At the "Step 4" the jboss-web.deployer configured, I can't find anything like this in my JBoss installation.
                          There are no rewrite rules in my virtual host file.
                          I guess you use CSS in your project, and could you please tell me how you managed to make the gateIn + css work using mod_jk? If I'm not going to use mod_proxy I should turn to mod_jk, though I read it is a little older.
                          • 10. Re: set site to virtualhost
                            rafael liu Newbie

                            Try this:

                             

                            ProxyPass /portal/public/anthill balancer://mycluster/portal/public/anthill

                             

                            That should work. In case you really want to do your way, you probably will need mod_proxy_html.

                             

                            Look at the HTML source and give us the printed URL for CSS.

                            • 11. Re: set site to virtualhost
                              Oleksii Vavilkin Newbie

                              Hi there!

                              I've got some results!

                               

                                  RewriteEngine On

                                  RewriteRule ^/portal(.*)$                        http://anthill.homelinux.net:8080/portal$1 [L]

                                  RewriteRule ^/eXoResources(.*)$           http://anthill.homelinux.net:8080/eXoResources$1 [L]

                               

                              And for the first time the page is displayed correctly! The balancer is set up for the short adress:

                               

                                   BalancerMember http://anthill.homelinux.net:8080/ route=node1

                                   ProxyPass                /  balancer://mycluster/portal/public/anthill

                                   ProxyPassReverse    /  http://anthill.homelinux.net:8080/portal/public/anthill

                               

                              Ok, and once I refresh my page - I recieve the one with nice GateIn things =) The problem occurs once I click somewhere. First - any address in the application is shown as /portal/anthill/public/etc... and I can't find out how to change this :-/ Well, you see - once clicked on any "command button" I goto a page, where the address is "/portal/public/anthill..." - not the "http://anthill.homelinux.net/portal/public/anthill..." And no javascript work (I guess the ajax one doesn't work). So, If I try the "Sign in" button - it just doesn't finish (the "loading" picture doesn't change for a while). Oh yes, I've got my own portlet at the "home page" - so I test the whole thing at once. Well, the primary objective is to setup mod_proxy for GateIn to work correctly.

                              The mod_proxy_http is also installed.

                               

                              So, I achieved this once I looked at the page as "view source" - an could write the correct RewriteRules. But I still haven't found where the Banner Portlet is located? Any idea? And how could I get the scripts that execute once I click at the "Sign in" link in the Banner Portlet? I've got many ear/war/jar files unzipped in GateIn folder, but still haven't located the source of Banner Portlet.