Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


VirtualHost on 443 and 80 Apache Reverse Proxy on CentOS 7 [Help Needed]
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

VirtualHost on 443 and 80 Apache Reverse Proxy on CentOS 7 [Help Needed]

JasonMJasonM Member
edited September 2022 in Help

Hi,
For my VPS
In Apache Cent0S 7 httpd.conf file I've set up Reverse Proxy as follows:

<VirtualHost *:443> ProxyPreserveHost On ServerName www.example.com SSLEngine On SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerExpire off SSLProxyCheckPeerName off SSLInsecureRenegotiation on SSLProxyVerify none SSLVerifyClient none SSLCertificateFile /etc/ssl/certs/example_com.crt SSLCertificateKeyFile /etc/ssl/certs/example_com.key ProxyPass / https://104.194.x.x/ ProxyPassReverse / https://104.194.x.x/ ProxyErrorOverride On </VirtualHost>

my configuration is
Cloudflare (full strict ssl) to vps to cpanel shared hosting
site is only served in https://

on cPanel htaccess, I've forced ssl redirect from http://www. to https://www.

My question is:
in the above httpd.conf file on my vps, do I need to add the following code for port 80 too?

<VirtualHost *:80>
ProxyPreserveHost On
ServerName www.example.com
ProxyPass / http://104.194.x.x/
ProxyPassReverse / http://104.194.x.x/
ProxyErrorOverride On
</VirtualHost>

Comments

  • RickBakkrRickBakkr Member, Patron Provider, LIR

    I do not really see why you are stacking reverse proxies though?

    Given your VPS will never be reached directly, the smart move would be to make CloudFlare always use ONE method of reaching your VPS, thus you only having to configure a single VHost on the VPS.

    Thanked by 1RapToN
  • I also have reverse proxy setup in apache, this is my config running uptime kuma.

    <VirtualHost *:80>
        ServerName uptime.xxx.net
        Redirect permanent / https://uptime.xxx.net/
    </VirtualHost>
    
    <VirtualHost *:443> 
        ServerAdmin [email protected]
        ServerName uptime.xxx.net.net    
        ProxyRequests Off
    
        RewriteEngine On
        ...
    
        <Location />
            ProxyPreserveHost On
            ProxyPass ...
            ProxyPassReverse ...
        </Location>
    
        SSLEngine on
        ...
    
    </VirtualHost>
    
    Thanked by 1JasonM
  • @Liso said: I also have reverse proxy setup in apache

    thanks. it worked.

  • vsys_hostvsys_host Member, Patron Provider

    @JasonM
    So you are using 2 virtual servers (proxy and Cpanel) and CF between them? If yes, this is quite strange; if no, and you have only Cpanel VPS, there is no sense in configuring a proxy virtual host.

  • JasonMJasonM Member
    edited September 2022

    @vsys_host said: So you are using 2 virtual servers (proxy and Cpanel) and CF between them? If yes, this is quite strange; if no, and you have only Cpanel VPS, there is no sense in configuring a proxy virtual host.

    Nopes. Its CF, VPS (proxy) and shared cPanel

  • vsys_hostvsys_host Member, Patron Provider

    @JasonM said: Nopes. Its CF, VPS

    It is enough that the cPanel generates a config and there is no need to add new virtual hosts

Sign In or Register to comment.