简体   繁体   中英

ProxyPass rule for Wordpress Site with Apache2

I have a wordpress site running on wordpress.myorg.com. For authentication I have to redirect it my internal server running CAS server.

Internal Server does not have DNS name. So, I'm using local DNS with IP address in HOST file to redirect to CAS server. All the things working correctly such a way.

Now I wanted to add ProxyPass rules, so that the User only sees wordpress.myorg.com all the time.

After adding ProxyPass rules, when I hit wordpress.myorg.com/wp-login.php it returns page with 500 internal error rather then showing CAS login screen.

Here is the Virtual Host entry I have done in Apache web server for Wordpress Site

<VirtualHost *:80>
    ServerAdmin your_email_address
    ServerName wordpress.myorg.com
    ServerAlias wordpress.myorg.com

    DocumentRoot /var/www/html/wordpress
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/html/wordpress>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    RewriteEngine On
    Options +FollowSymLinks
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?CAS/(.*) https://wordpress.myorg.com/CAS/$1 [R,NE,L]

</VirtualHost>
<VirtualHost *:443>

    ServerAdmin your_email_address
    ServerName wordpress.myorg.com
    ServerAlias wordpress.myorg.com

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/myorg.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/myorg.com.key

    ProxyRequests On
    ProxyVia On

    ProxyPass /CAS/ ajp://cas.myorg.com:8009/CAS/
    ProxyPassReverse /CAS/ ajp://cas.myorg.com:8009/CAS/

</VirtualHost>

Any help on this would be appreciable.

Thanks.

Got the issue. I forgot to enable SSLProxyEngine . Just enabled it and its working like a charm.

Edit for HTTPs portion.

<VirtualHost *:443>

    ServerAdmin your_email_address
    ServerName wordpress.myorg.com
    ServerAlias wordpress.myorg.com

    SSLEngine on
## Added these lines ##
    SSLProxyEngine On
    SSLProxyCheckPeerCN on
    SSLProxyCheckPeerExpire on
## -- ##
    SSLCertificateFile /etc/apache2/ssl/myorg.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/myorg.com.key

    ProxyRequests On
    ProxyVia On

    ProxyPass /CAS/ ajp://cas.myorg.com:8009/CAS/
    ProxyPassReverse /CAS/ ajp://cas.myorg.com:8009/CAS/

</VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM