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>
Related
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.
I install Apache Haus in my Windows 10 PC, that should work as Reverse Proxy.
my setting in httpd-vhosts.conf is like below:
<VirtualHost _default_:80>
DocumentRoot "$(SRVROOT)/htdocs"
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://172.17.3.177/
ProxyPassReverse / http://172.17.3.177/
</VirtualHost>
<VirtualHost _default_:80>
DocumentRoot "${SRVROOT}/htdocs"
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://172.17.3.177/
ProxyPassReverse / http://172.17.3.177/
SSLEngine on
SSLCertificateFile "${SRVROOT}/conf/ssl/server.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/ssl/server.key"
</VirtualHost>
When I open http://localhost in browser the website from 172.17.3.177, successfully rendered (see below pic)
But when I try https://localhost my browser shows failure.
Can anybody help? I already disable windows firewall.
I have never implemented HTTPS on Apache.
However, your configuration seems to miss the listening to port 443 which is the default port for HTTPS.
You should add
Listen 443 // instruction at global server configuration
<VirtualHost _default_:443> // in your VirtualHost definition
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?
I want to redirect my Apache Server to my node server running on other
port on localhost Like when i enter localhost:80 it should redirect my node server which is running on localhost:3000.
<VirtualHost *:3000>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.example.com
ServerAlias example.com
ProxyPass / http://localhost:80/example/
ProxyPassReverse / http://localhost:80/example/
</VirtualHost>
I have two project that write with spring boot, and have separate port number.
server.port: 23100
server.port: 23101
now, I want to deploy the two project into one server and shard the same port 80,
How should I do to support this case ?
I know it can use Apache Http Server to support PHP etc. how to do this will Spring Boot ?
Update
thanks #HeadBangingSloth give this solution, general idea is to redirect 80 port to local port number according to domain name.
create vhost.conf file in /etc/httpd/conf.d/ folder
add following content according to your real case.
restart http server via service httpd restart
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.app1.com
ServerAlias app1.com
ProxyPass / http://localhost:23100/
ProxyPassReverse / http://localhost:23100/
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.app2.com
ServerAlias app2.com
ProxyPass / http://localhost:23101/
ProxyPassReverse / http://localhost:23101/
</VirtualHost>
I would suggest looking at this question here Apache redirect to another port
If you deploy your applications to your sever, you can set up your VirtualHosts in Apache to pass the incoming connections along
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.app1.com
ServerAlias app1.com
ProxyPass / http://localhost:23100/
ProxyPassReverse / http://localhost:23100/
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.app2.com
ServerAlias app2.com
ProxyPass / http://localhost:23101/
ProxyPassReverse / http://localhost:23101/
</VirtualHost>