Create a new site file
bash -c "cat > /etc/apache2/sites-available/www.example.com.conf" <<'EOF'
<VirtualHost *:80>
ServerName www.example.com
ServerSignature Off
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://x.x.x.x/
ProxyPassReverse / http://x.x.x.x/
</VirtualHost>
EOF
Enable the proxy modules
a2enmod proxy_http
systemctl restart apache2.service
Enable the new site
a2ensite www.example.com.conf
systemctl reload apache2.service