Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I got this EXACT problem figured out, and I finally got all iterations of URL’s to work listed at the bottom.
    Here is the code that works for me.

    Proxy:

    <VirtualHost *:80>
    
       ServerName test.x.com
       ServerAlias www.test.x.com
       Redirect / https://test.x.com/
    
    </VirtualHost>
    
    <VirtualHost *:443>
    
       ServerName test.x.com
       ServerAlias www.test.x.com
    
       Redirect /www.test.x.com/ /test.x.com/
    
       RequestHeader set X-Forwarded-Proto "https"
       RequestHeader set X-Forwarded-Port "443"
    
       <Proxy *>
            Order deny,allow
            Allow from all
       </Proxy>
    
       ProxyPreserveHost On
       SSLProxyEngine on
       ProxyPass / https://192.168.1.19:80/
       ProxyPassReverse / https://192.168.1.19:80/   
    
       SSLEngine on
       Include /etc/letsencrypt/options-ssl-apache.conf
       SSLCertificateFile /etc/letsencrypt/live/x.com-0002/fullchain.pem
       SSLCertificateKeyFile /etc/letsencrypt/live/x.com-0002/privkey.pem
    
    </VirtualHost>

    This is the end server:

    <VirtualHost *:80>
    DocumentRoot /var/www/html
    </VirtualHost>

    In the wp-config.php file, you have to add:

    if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    	$_SERVER['HTTPS'] = 'on';
    }

    That’s it. That’s the magic formula that finally made everything work:

    https://www.x.test.com
    https://www.x.test.com/wp-admin
    https://x.test.com
    https://x.test.com/wp-admin
    https://www.x.test.com
    https://www.x.test.com/wp-admin
    https://x.test.com
    https://x.test.com/wp-admin

    This is a setup for 4 domains on 4 raspberry Pi’s, one of them performing proxy, the other 3 on their own proxied boxes.

    I hope this helps someone. I found Apache very simple, but so many out there had code that broke when trying to go to /wp-admin or enter www. The last puzzle was to fix the fact that my cert didn’t support www subdomain, therefore the redirect in the :443 section.

    The live site that uses this is test.qso.com and you can see how this code works just as described.

    • This reply was modified 2 years, 8 months ago by n7okn.
    • This reply was modified 2 years, 8 months ago by n7okn.
    • This reply was modified 2 years, 8 months ago by n7okn.
    Thread Starter n7okn

    (@n7okn)

    Thank you for showing me that plug-in. I may end up using that.
    What I really wanted to find out is where to tell my right blog bar which category to display, and then on another page, to tell the right blog bar the posts in a different category. Otherwise I don’t see the point of categories if you can’t separate the posts.
    Also I did find the way to make the URL of a category, simply “/?cat=foo” and that does work. Can I make “foo” blog page to have the same look as my right blog bar?

Viewing 2 replies - 1 through 2 (of 2 total)