Issu with varnish-ban-manager installation, using vhost in AWS - http

I've installed varnish-ban-manager (https://github.com/dot2code/varnish-bans-manager) and I'm currently configuring it's DNS name.
The thing is that I've set in Route53 (DNS service in AWS) to use name http:// purge.domain.com / pointing to http:// varnish_server_name.com/. The thing is, if I test with http :// purge.domain .com:9000/ it works normally, but using http: //purge.domain.com/ will send me a "your request cannot be processed" (in a varnish error screen).
Any ideas why this could be happening? I've test this with the ip address of this vm and works perfectly too..
Here's the vhost config file:
<VirtualHost *:80>
ServerName purge.domain.com
ServerAlias purge.domain.com
ProxyPass / http://varnish_server.domain:9200/
ProxyPassReverse / http://purge.domain.com/
# Logging
ErrorLog logs/server-error_log
CustomLog logs/server-access_log combined
</VirtualHost>
Note: i've replaced my real domain for "domain" just in case.
Thanks guys!!

Solved. I've added some lines to vhost:
ServerName http:// purge.comain.com
ProxyPass / http:// varnish_server:9000/
ProxyPassReverse / http:// varnish_server:9000/
ErrorLog logs/purge. cloud-turner.com.ar-error_log
CustomLog logs/purge. cloud-turner.com.ar-access_log combined
And added proxy.conf (/etc/httpd/conf.d/) with this line
ProxyPreserveHost on
And that's it!

Related

ASP.NET application not accessible through Apache proxy on Linux

I need to clarify the process of pointing a web domain to a running ASP.NET application on a raspberry pi. The application is developed and ready, and the website is up and running. I have researched multiple posts and can't find anything wrong with my proxy redirect.
Is dotnet blocking the recieved redirect in someway by locking out any external visitors from the application?
Since there are multiple ways of setting up such an environment. Do I need to configure both an XForwarding in my application as well as a ProxyPass in Apache?
I have an SSL via Letsencrypt, protecting the traffic on my website. This worked fine when running a simple HTML/CSS layout. Do I need to acquire a certificate for my application aswell?
Overall the setup is not working, and I'm itching to understand why. Most threads seem to imply its as simple as running the app on port x -> pointing to port x -> success. For me this isn't working...
Through wget I successfully reach my website via both ports (since I redirect HTTP to HTTPS). By entering the localhost:port into browser I can find the application. Why is my proxy not working?
Accessing my website
https://localhost:7199
Apache2 Virtual host
<VirtualHost *:80>
ServerName www.website.com
RedirectPermanent / https://www.website.com
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster#localhost
ServerName www.website.com
ServerAlias www.website.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:7199/
ProxyPassReverse / http://localhost:7199/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.website.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.website.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/www.website.com/chain.pem
</VirtualHost>
</IfModule>
All and any thoughts are very appreciated. Thanks for reading!

Issue with Apache2 Reverse proxy

I need to create a reverse proxy in apache2 for an icecast server, but with another virtualhost as a simple website
I managed to create the reverse proxy, using this configuration in apache Virtualhost
<VirtualHost 100.100.100.100:80>
ServerName icecast.xxx.com
ProxyPass / http://localhost:8000/
</VirtualHost>
100.100.100.100 is the ip of the server, and xxx.com is the domain
So when i type in my browser icecast.xxx.com the icecast admin panel (on 8000 port) show up
Then i have added another virtualhost
<VirtualHost *:80>
ServerName xxx.com
ServerAlias www.xxx.com
ServerAdmin MY_EMAIL
DocumentRoot /var/www/site/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have enabled him with sudo a2ensite NAME_OF_THE_CONFIG_FILE
But when I go to the ip of the VPS or to xxx.com/www.xxx.com the icecast2 admin panel show up!
I don't know how to solve this, I maybe think that the error is in the line
I finally managed to solve the issue,
simply in the reverse proxy virtualhost, instead of <VirtualHost 100.100.100.100:80>
I need to put
<VirtualHost *:80>

Add SSL to a Dockerzied wordpress container

I have two Docker containers (Wordpress and MySQL) and I installed Apache on the server.
So it looks something like this;
I am trying to add an SSL certificate to it with Certbot.
So far, my Apache configuration file is this;
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://localhost:4567/
ProxyPassReverse / http://localhost:4567/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
And I have added this two lines of code to wp-config.php;
define('WP_HOME', 'http://example.com/');
define('WP_SITEURL', 'http://example.com/');
When I use certbot --apache and choose the domain to add the SSL certificate, the website "brakes"; no CSS, no JS, no images and I can't access to the admin (to try to change http to https using Search and Replace);
I tried to change http with https and add define('FORCE_SSL_ADMIN', true); to wp-config.php but that didn't work;
Do anyone know the perfect way to add an SSL to Dockerized wordpress container?
PS: I tried a desperate move to change manually all the http://example.com to https://example.com in all tables in the database. it didn't work and it is a pretty stupid thing to do, but desperate times call for desperate measures.
This needs to be https, otherwise your assets will load from http resulting in mixed content.
define('WP_HOME', 'https://example.com/');
define('WP_SITEURL', 'https://example.com/);
This is the apache config file from bitnami images, maybe this helps:
<VirtualHost *:80>
ServerName wordpress.example.com
ServerAlias www.wordpress.example.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName wordpress.example.com
ServerAlias www.wordpress.example.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpress/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpress/conf/certs/server.key"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

XAMPP Wordpress Site is not accessible from production server

My Needs are
1. Configure Multiple Domain on XAMPP server on production (Woocommerce Site)
2. Configure and enable ssl
Steps i followed
Edited httpd-vshost as
NameVirtualHost *:80
ServerAdmin mail#firstsite.in
DocumentRoot "C:/xampp/htdocs/firstsite"
Allow from all
ServerName firstsite.in
ServerAlias www.firstsite.in
ServerAdmin mail#secondsite.in
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secindsite.in
ServerAlias www.secondsite.in
Allow from all
Edited httpd-ssl
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/firstsite"
ServerName firstsite.in:443
ServerAlias www.firstsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\mibstore\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\mibstore\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\mibstore\server.key"
</VirtualHost>
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secondsite.in:443
ServerAlias www.secondsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\ricebazzar\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\ricebazzar\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\ricebazzar\server.key"
</VirtualHost>
I have obtained SSL certificate from sslforfree and stored them on relevant path
I also edited etc\hosts file
127.0.0.1 firstsite.in
127.0.0.1 secondsite.in
Issue
I can able to browse them from the server(windows) itself , but can't able to access them from outside. the relevant domain names are purchased and added a A record to point the IP.
Notes
Using Amazon AWS EC2 instance
Added Inbound Rules on 80 & 443, And also added firewall rules on 80 & 443
Would you tried in another PC to visit them since you changed your host file on your PC.
If they can be visited then you need remove the record of your host file.
If not, please try:
Does both the A record of WWW and Non-WWW have been pointed to IP.
If pointed, please tell me what error or message you see on browser when you load the websites.
If there're no error or message which means they are blank page, please try to check is there any htaccess file, do you enable the rewrite mod of xampp.

How to run different website in a same domain with HTTP and HTTPS

Can i run different websites in same domain. like
http://www.example.com ----> in WordPress
https://example.com/ -----> in laravel
Here is the reference site
Website : www.linqs.in
APP: https://linqs.in/username
App url will open user's profile by provided username.
sorry if i made mistake !! if this possible please guide me.
You can do this in your virtual host configuration:
Listen 80
Listen 443
<VirtualHost *:80>
ServerName example.com
DocumentRoot "/path/to/wordpress"
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot "/path/to/laravel/public"
</VirtualHost>
You may also need to define directories if the sources are not under your default http root. For example:
<VirtualHost *:443>
ServerName example.com
DocumentRoot "/path/to/laravel"
<Directory /path/to/laravel>
AllowOverride All
</Directory>
</VirtualHost>
This will also allow Apache to serve that directory and use any .htaccess files (if it wasn't allowed already).
Since URL listen on port like http - port 80, https - port 443. So, you can ensure different website in a same domain via VirtualHost configure.

Resources