Issue with Apache2 Reverse proxy - networking

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>

Related

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.

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

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!

Wordpress + Wordpress Network on Single Server conflict

I have two installs of wordpress on a single Amazon EC2 server. One of them is just a regular wordpress install, the other being a wordpress network install, with WP Domain Mapping installed.
So let's say I have four domain names: site.example.com, multisite.example.com, multisite1.com and multisite2.com
All of the domain names are pointing to the same IP address. Multisite1.com and multisite2.com are domain mapped to blogs under the multisite.example.com wordpress network
On my server httpd.conf is setup as follows:
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/site1
ServerName site.example.com
ErrorLog logs/site_error_log
CustomLog logs/site_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite.example.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
Right now, all of the domains seem to go to the right place - until I start getting to the wp-admin panel.
site.example.com/wp-admin and multisite.example.com/wp-admin appear to work fine.
multisite1.com/wp-admin and multisite2.com/wp-admin both seem to redirect to site.example.com/wp-admin instead of multisite.example.com/wp-admin.
I can't figure out why. I have tried putting all of the domain names in the virtual host as ServerAlias but it doesn't seem to have helped. I've also put in a wildcard ServerAlias under multisite.example.com as well, but no luck.
Any ideas? It is a bizarre install I know, but for the time being for other reasons, I have to get it to work this way. I will eventually separate the two.
Create a new sites-available entry for each of your sub-domain or virtual host for each sub-domain pointing to the same web root and reload the apache. After that all will work fine.
For e.g.
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite1.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite2.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>

Multiple urls to single host with port mapping?

When one registers a url with a dns registrar can they include port mapping to the host computer?
www.myurl1.com myip:80
www.myurl2.com myip:81
Basically can one map several urls to the same host computer using port 80 as seen from the outside(so one doesn't have to do www.myurl2.com:81)?
You can add Virtual Hosts to your webs-servers conf file. Just have your dns registrar point all your domains to the same IP# port :80 and the web-server will do the rest.
See http://httpd.apache.org/docs/2.0/vhosts/
Apache httpd.conf example:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/myurl1.com/"
ServerName myurl1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/myurl1.com/"
ServerName myurl2.com
</VirtualHost>
Nginx - See http://wiki.nginx.org/ServerBlockExample

Resources