Apache: Site become unavailable when SSL is added - apache

I'm using Apache2 in ubuntu to rout the request to a tomcat webapp. I am also trying to add SSL into this. Below is the apache 000-default.conf file.
<VirtualHost *:80>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
ServerName localhost
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster#localhost
DocumentRoot /opt/apache-tomcat-7.0.79/webapps/myglukose_messaging_portal/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateFile /etc/apache2/ssl/STAR_myglukose_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/private_key.key
ProxyPreserveHost On
ProxyPass / http://<my-ip>/:8080/
ProxyPassReverse / http://<my-ip>/:8080/
ServerName localhost
</VirtualHost>
Everything was fine until I made the configuration for port 443. When that is made, the site simply becomes unavailable and the browser says "This site can’t be reached. refused to connect.". My tomcat web app is deployed as "ROOT" so can be accessed with the port 80 configuration. Whats wrong here?

Related

Archiva login hangs with apache2 proxy

Archiva login hangs with apache2 proxy
<VirtualHost *:443>
ServerName mydomain.com
DocumentRoot /var/www/html
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
SSLEngine on
SSLCertificateFile /etc/ssl/mycert.pem
SSLCertificateKeyFile /etc/ssl/mykey.pem
</VirtualHost>
Archiva is running on port 8080.
Create admin user -> Save -> Login (loading ... hangs)

Apache and Spring https redirect to wrong URL

I have a SpringBoot application running on http://localhost:8080/ and Apache. Apache redirects all requests from *:80 to *:443 and 443 to http://localhost:8080.
When I try to access http://domain_name.com/login it redirects me to https://domain_name.comlogin/
Also if i try to access pages without authentication it should redirects me to login page, but it redirects me to https://domain_name.comlogin/ instead of https://domain_name.com/login and the same with /logout
What's the problem with redirecting. Is it with Apache or Spring?
<VirtualHost *:80>
ServerName domain_name.com
ServerAdmin admin#domain_name.com
Redirect permanent / https://domain_name.com/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLProxyEngine On
ProxyPreserveHost On
ServerName domain_name.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/apache2/certificate/domain_name.crt
SSLCertificateKeyFile /etc/apache2/certificate/private.key
SSLCertificateChainFile /etc/apache2/certificate/chain.crt
</VirtualHost>

Domain redirected you too many times

I have an Apache web server.
I would like to setup a reverse proxy to access a local application running on port 9090.
Here is my apache configuration :
ProxyRequests Off
NameVirtualHost *:80
NameVirtualHost *:443
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
# Redirect HTTP requests to HTTPS
<VirtualHost *:80>
DocumentRoot "${SRVROOT}/htdocs/example.com/public_html"
ServerName example.com
ServerAlias example
Redirect / https://www.example.com/
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "${SRVROOT}/htdocs/example.com/public_html"
ServerName example.com
ServerAlias example
ProxyPass / http://127.0.0.1:9090/
ProxyPassReverse / http://127.0.0.1:9090/
ProxyPreserveHost On
RequestHeader unset Origin
</VirtualHost>
The configuration is not working. I'm getting the error : example.com redirected you too many times
The server is hosted at an EC2 AWS instance.
Does anyone know how to solve that please ?
Thanks.

Enable Multiple Hosts

I configured my Debian server with Apache where I listen to my api at http: // localhost or http: // localhost: 3000 and I get my jsons.
Now I would like to enable another server in www / html / uploads, where I will use it for uplodas files. How do you do it?
\
000-default.conf:
<VirtualHost *:80>
# ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://localhost:3000/
#ServerName localhost
</VirtualHost>
You can either write to the 000-default.conf file or create a new .conf file
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /www/html/uploads
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Apache - virtual host - proxy - https

I have some servers with http apps. Now i need to secure it with https but i cant do it individualy, all of them is on same public IP.
So i decided to create HTTP Gateway - transparent proxy server. I must run it on Windows Server 2016.
I have installed XAMPP server and letsencrypt-simple. I have successfully requested and installed certificate, but on visit of website it is still make "Too many redirects" (and it is secured by HTTPS), whitout proxy it works well.
My virtualhosts:
<VirtualHost *:80>
ServerName [public_domain_name]
ProxyPreserveHost On
DocumentRoot C:\HTTP\SERVER\htdocs\app1
ProxyPass C:\HTTP\SERVER\htdocs\app1\.well-known !
ProxyPass / http://192.168.1.9/app1/
ProxyPassReverse / http://192.168.1.9/app1/
</VirtualHost>
<VirtualHost *:443>
ServerName [public_domain_name]
ProxyPreserveHost On
DocumentRoot C:\HTTP\SERVER\htdocs\app1
ProxyPass C:\HTTP\SERVER\htdocs\app1\.well-known !
ProxyPass / http://192.168.1.9/app1/
ProxyPassReverse / http://192.168.1.9/app1/
SSLEngine on
SSLCertificateFile "C:\ProgramData\win-acme\httpsacme-v01.api.letsencrypt.org\[public_domain_name]-crt.pem"
SSLCertificateKeyFile "C:\ProgramData\win-acme\httpsacme-v01.api.letsencrypt.org\[public_domain_name]-key.pem"
SSLCertificateChainFile "C:\ProgramData\win-acme\httpsacme-v01.api.letsencrypt.org\ca-[public_domain_name]-crt.pem"
</VirtualHost>