RewriteRule/ProxyPass

classic Classic list List threaded Threaded
4 messages Options
gleissonbr gleissonbr
Reply | Threaded
Open this post in threaded view
|

RewriteRule/ProxyPass

Hello Everyone, 

  I finished up customizing a Plone site. It runs on serveripaddress:9082/Intranet. I need that the server redirects to that address serveripaddress:9082/Intranet when the user types website.com on the browser. I was told to look RewriteRule/ProxyPass. I found this step by step http://docs.plone.org/manage/deploying/front-end/apache.html. So I installed and configured apache. Now it responds with the apache default page for port 80 when i type website.com on the browser. I wrote a file according to the step by step but my Plone site is not being redirect when the user types website.com This is the rule on the file: 


My Plone listens on 9082, cnbw.mb is my domain and Intranet is my site on the ZMI control panel. 

What did i do wrong? 

Thanks for all the help! 
Gleisson Henrique 

_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup
Nicolas Göddel Nicolas Göddel
Reply | Threaded
Open this post in threaded view
|

Re: RewriteRule/ProxyPass

Maybe you have other VirtualHosts in your apache configuration which were executed before your Rule.

What is the content of your "/etc/apache2/ports.conf", which files are in "/etc/apache2/sites-enabled/" and "/etc/apache2/conf.d"? And did you enable the the rewrite-mod?

Am 13.01.2015 um 21:38 schrieb Gleisson Henrique:
Hello Everyone, 

  I finished up customizing a Plone site. It runs on serveripaddress:9082/Intranet. I need that the server redirects to that address serveripaddress:9082/Intranet when the user types website.com on the browser. I was told to look RewriteRule/ProxyPass. I found this step by step http://docs.plone.org/manage/deploying/front-end/apache.html. So I installed and configured apache. Now it responds with the apache default page for port 80 when i type website.com on the browser. I wrote a file according to the step by step but my Plone site is not being redirect when the user types website.com This is the rule on the file: 


My Plone listens on 9082, cnbw.mb is my domain and Intranet is my site on the ZMI control panel. 

What did i do wrong? 

Thanks for all the help! 
Gleisson Henrique 


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup
gleissonbr gleissonbr
Reply | Threaded
Open this post in threaded view
|

Re: RewriteRule/ProxyPass

Hey Nicolas, 


 Thanks for your reply. 

The content of my ports.conf is: 

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I have the following files on /etc/apache2/sites-enabled :


000-default.conf  cnbw.conf  cnbw.mb.conf


I dont have conf.d on /etc/apache2. This is what I have on /etc/apache2 :

apache2.conf    conf-enabled  magic           mods-enabled  sites-available
conf-available  envvars       mods-available  ports.conf    sites-enabled


Where else do you need to help me out? 

Thanks!!! I really appreciate your reply! 

Gleisson 


Abraço, 
Gleisson Henrique 

On Tue, Jan 13, 2015 at 6:50 PM, Nicolas Göddel <[hidden email]> wrote:
Maybe you have other VirtualHosts in your apache configuration which were executed before your Rule.

What is the content of your "/etc/apache2/ports.conf", which files are in "/etc/apache2/sites-enabled/" and "/etc/apache2/conf.d"? And did you enable the the rewrite-mod?

Am 13.01.2015 um 21:38 schrieb Gleisson Henrique:
Hello Everyone, 

  I finished up customizing a Plone site. It runs on serveripaddress:9082/Intranet. I need that the server redirects to that address serveripaddress:9082/Intranet when the user types website.com on the browser. I was told to look RewriteRule/ProxyPass. I found this step by step http://docs.plone.org/manage/deploying/front-end/apache.html. So I installed and configured apache. Now it responds with the apache default page for port 80 when i type website.com on the browser. I wrote a file according to the step by step but my Plone site is not being redirect when the user types website.com This is the rule on the file: 


My Plone listens on 9082, cnbw.mb is my domain and Intranet is my site on the ZMI control panel. 

What did i do wrong? 

Thanks for all the help! 
Gleisson Henrique 


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup



_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup
Nicolas Göddel Nicolas Göddel
Reply | Threaded
Open this post in threaded view
|

Re: RewriteRule/ProxyPass

Hi Gleisson,

first add the line "NameVirtualHost *:80" to you ports.conf. It should look similar to this one (Ubuntu standard):

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    NameVirtualHost *:443
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    NameVirtualHost *:443
    Listen 443
</IfModule>

This way apache is able to chose the right configuration which matches to your domain name.
Next if you do not need the default apache site you can disable it by typing "a2dissite default". It should look like this:

hostname:/etc/apache2/sites-available# a2dissite default
Site default disabled.
To activate the new configuration, you need to run:
  service apache2 reload

Then the entry /etc/apache2/sites-enabled/000-default.conf should be gone. It was a symbolic link to /etc/apache2/sites-available/default .

I do not know why do you have two more files in that directory. I guess you only need one of them. "cnbw.conf" or "cnbw.mb.conf". I can show you how my VirtualHost files always look. I do not use RewriteRule, instead I use ProxyPass and a LoadBalancer because I often need more that one client. I added some TODO comments in the code.
Before this file is working you need to enable some apache modules with this line:

a2enmod proxy_balancer proxy_http proxy rewrite

Now the file /etc/apache2/sites-available/cnbw.conf

<VirtualHost *:80>
    ServerName www.domain.de # TODO: Change the Domain here
    ServerAlias domain.de # TODO: Use this to also accept the domain without www
    ServerAdmin [hidden email]
   
    <IfModule mod_proxy.c>
        ProxyVia on
       
        # prevent the webserver from beeing used as proxy
        <LocationMatch "^[^/]">
            Deny from all
        </LocationMatch>
       
        # balancer
        <Location /balancer-manager>
            SetHandler balancer-manager
            Order Deny,Allow
            Allow from all
        </Location>
       
        <IfModule mod_rewrite.c>
            RewriteEngine on
            RewriteMap lowercase int:tolower
           
            RewriteRule ^ - [E=SERVER_NAME:${lowercase:%{SERVER_NAME}}]
           
            <Proxy balancer://lb>
                BalancerMember http://serveripaddress:9082 # TODO: Change serveripaddress to the ip of your server
                # Add more clients here:
                #BalancerMember http://serveripaddress:9083
                #...
            </Proxy>
           
            ProxyPassInterpolateEnv On
           
            ProxyPass /balancer-manager !
            # This is the VHM (Virtual Host Monster). ${SERVER_NAME} automatically contains the name of the calling domain.
            ProxyPass / balancer://lb/VirtualHostBase/http/${SERVER_NAME}:80/Intranet/VirtualHostRoot/ interpolate
            ProxyPassReverse / balancer://lb/VirtualHostBase/http/${SERVER_NAME}:80/Intranet/VirtualHostRoot/ interpolate
        </IfModule>
    </IfModule>
</VirtualHost>

Be sure to save the file in "/etc/apache2/sites-available/" and then to enable it with "a2ensite <filename>". Then a symbolic link to it will be generated in "/etc/apache2/sites-enabled".

Now call "service apache2 restart" or "/etc/init.d/apache2 restart" (depends on your system) and it should do what you expect.

Regards,
Nicolas

Am 14.01.2015 um 15:58 schrieb Gleisson Henrique:
Hey Nicolas, 


 Thanks for your reply. 

The content of my ports.conf is: 

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I have the following files on /etc/apache2/sites-enabled :


000-default.conf  cnbw.conf  cnbw.mb.conf


I dont have conf.d on /etc/apache2. This is what I have on /etc/apache2 :

apache2.conf    conf-enabled  magic           mods-enabled  sites-available
conf-available  envvars       mods-available  ports.conf    sites-enabled


Where else do you need to help me out? 

Thanks!!! I really appreciate your reply! 

Gleisson 


Abraço, 
Gleisson Henrique 

On Tue, Jan 13, 2015 at 6:50 PM, Nicolas Göddel <[hidden email]> wrote:
Maybe you have other VirtualHosts in your apache configuration which were executed before your Rule.

What is the content of your "/etc/apache2/ports.conf", which files are in "/etc/apache2/sites-enabled/" and "/etc/apache2/conf.d"? And did you enable the the rewrite-mod?

Am 13.01.2015 um 21:38 schrieb Gleisson Henrique:
Hello Everyone, 

  I finished up customizing a Plone site. It runs on serveripaddress:9082/Intranet. I need that the server redirects to that address serveripaddress:9082/Intranet when the user types website.com on the browser. I was told to look RewriteRule/ProxyPass. I found this step by step http://docs.plone.org/manage/deploying/front-end/apache.html. So I installed and configured apache. Now it responds with the apache default page for port 80 when i type website.com on the browser. I wrote a file according to the step by step but my Plone site is not being redirect when the user types website.com This is the rule on the file: 


My Plone listens on 9082, cnbw.mb is my domain and Intranet is my site on the ZMI control panel. 

What did i do wrong? 

Thanks for all the help! 
Gleisson Henrique 


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup


_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup




_______________________________________________
Setup mailing list
[hidden email]
https://lists.plone.org/mailman/listinfo/plone-setup