We're trying to set up two sites on same Apache instance, although on different ports.
We have a ReviewBoard set up on an Apache in an AWS instance. It runs on 443, and is working fine.
Now, we're trying to set up MediaWiki on same server. I'm assuming safest and fastest way is to set it to listen on a different port. So, we've set up Apache to listen on 8443, and enabled MediaWiki like so
<IfModule mod_ssl.c>
<VirtualHost _default_:8443>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/<domain_name>
This is working fine for accessing homepage of wiki.
following are the issues we're facing -
This setup requires adding port to the URL. Since https by default uses 443, we need to add :8443 at end of url to access Wiki Page. Ideally, we'd like to do away with the port.
MediaWiki Login doesn't work. After login, user is redirected to port 80. If this port is blocked, which is what we want, whole flow is dead in water.
We'd like to use same AWS instance, although we're open to setting up another instance of Apache (not sure if it is possible / best practice).
Any ideas?
For issue number 2, make sure that you've updated your $wgServer variable to include the not-standard port number like so $wgServer = "https://127.0.0.1:8443";
Thanks TyA.
Solved this.
Multiple domain with the same ip and port in apache
TyA's solution.
Separate AWS or Apache instance not required.
Related
I have the following problem:
I have my HomeServer on IP 192.168.0.1, it's an exposed host, getting every access from outside.
On this Server I have running some lxc containerts, two of them have apache2, etc on it.
Now I want to access every server via a special URL, for example:
cloud.example.com -> going to the "cloud" container on IP 192.168.0.101
torrent.example.com -> going to the "torrent" container on IP 192.168.0.103
everything else should go the HomeServer on 192.168.0.1
I thought of it like this: everything should go to 192.168.0.1, there I would have some VirtualHosts looking for the URL and forwarding the traffic to the needed server or showing the "default" page of the HomeServer (192.168.0.1)
The thing is, I've searched for quite a while but can't find the stuff I need.
Someone an idea?
Thanks in advance
Something like that maybe :
<VirtualHost *:80>
ServerName cloud.example.com:80
ProxyPass / http://192.168.0.101/
ProxyPassReverse / http://192.168.0.101/
</VirtualHost>
The "default page" being in the document root of the main configuration (not the virtual host).
You could also try using Caddy web server as a reverse proxy, it is the simplest to manage that I've come across and the config file is much simpler than Apache or NGINX.
I am now using HAProxy and it's working perfectly.
Send requests from outside to router -> router sends it to HAProxy container -> HAProxy sends it to the needed container
I use a Bitnami MEAN installation (https://bitnami.com/stack/mean) v 3.2.11 on EC2. I didn't do any extra modifications of the apache2 setup except for the rerouting the port where my app runs to port 80, like this
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
Now my app is available fine on :80 port via http:// but I can't make it run via https://. But access via https is what I wanted to achieve. I could not figure the right step by step guide on how to create or enable SSL. All Bitnami docs sound like it's assumed to be working already.
As far as I understood from - https://docs.bitnami.com/aws/components/apache/#https-port the basic certificate is already included into the setup so you can make use of that one without creating your own. The only thing you need is to enable it - That may be wrong assumption, let me know.
Also here on bitnami support it says
Apache waits for HTTPS requests on port 443. Change that by editing
the /opt/bitnami/apache2/conf/bitnami/bitnami.conf file and modifying
the value specified in the Port directive. For example:
Listen 8443
Does that mean that I need to reroute my :5000 port to :8443 ??
I've also found this question - Installing SSL on AWS EC2 Bitnami Mean Stack that didn't recieve a proper answer for more than a year.
Does that mean that I need to reroute my :5000 port to :8443 ??
No, you don't need to redirect that. Your problem is that you're proxy-passing every request from port 80 to 5000 (where your app runs) but when using HTTPS your requests use the port 443. Those request are not being proxy-passed to port 5000 and, therefore, your app doesn't receive them.
What Apache configuration file did you modify including those lines? You need to be sure that both the VirtualHosts for port 80 and the one for port 443 include the ProxyPass redirections. For example, if you edited the file /opt/bitnami/apache2/conf/bitnami/bitnami.conf, ensure you add it in the Virtualhosts <VirtualHost _default_:80> and <VirtualHost _default_:443>
As far as I understood from - https://docs.bitnami.com/aws/components/apache/#https-port the basic certificate is already included into the setup so you can make use of that one without creating your own.
Yes, the Bitnami Stack includes a dummy certificate. However, it's recommended to create your own one since the browsers won't recognize it as a valid one since it's self-signed. You can find more information in the link below:
https://docs.bitnami.com/aws/components/apache/#how-to-create-an-ssl-certificate
As my home network grows, I am finding that I would like to get more access from the outside world and it seems this requires me to grow beyond port forwarding in my router. I have several systems (mostly virtualized) that use ports 80 and 443 (mostly) and I cannot forward those ports to multiple IP addresses. This is where I planned to use Reverse Proxy.
I am testing this on an Ubuntu 12.04 LTS system running Apache2. I have created a file called reverseprox in /etc/apache2/sites-available as follows:
root#server:/etc/apache2# cat sites-available/reverseprox
<VirtualHost *:80>
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerName ws.myDomain.asuscomm.com
ServerAlias ws
ProxyRequests Off
ProxyPass / http://192.168.1.64:80/
ProxyPassReverse / http://192.168.1.64:80/
</VirtualHost>
I followed the tutorial from here:
http://www.linuxjournal.com/content/protect-your-ports-reverse-proxy?page=0,1
My web server is on 192.168.1.64 on my local network. I have an Asus router and am using Asus DDNS service setup as myDomain.asuscomm.com. I have also setup all the sym-links as required for Apache to find the necessary modules and get no errors when I restart the apache2 service (except for complaints about the loopback address in the 000-default file). I have forwarded port 80 in my router to the system running apache (on 192.168.1.62) and can see the blank "It Works!" web page so it is clear that myDomain.asuscomm.com:80 is getting to 192.168.1.62 but my VirtualHost doesnt seem to do anything when i enter ws.myDomain.asuscomm.com.
Am I missing something? Is it the fact that I am using the Asus DDNS service and myDomain.asuscomm.com is not a valid domain name? I have no problem registering a domain name to get this to work if needed. I plan to expand this to my other systems, like nas.myDomain.asuscomm.com, vSphere.myDomain.asuscomm.com, etc...
I appreciate the help!
I figured this out. I was never able to use the DDNS name directly. The solution was to pay some $$$ and register a domain name. I used NameCheap.com and registered a domain name with premium DNS service and privacy protection for $15/year.
Then, I created CNAME records of my desired URL's and set the targets to be my DDNS URL. Once the DNS servers were updated with the new CNAME records (took about 15 min), bingo! Reverse proxy works!
For example, I registered myDomain.com. In my NameCheap account settings under advanced DNS options (should be the same concept with other domain register services like GoDaddy), I defined a CNAME record with Host set to ws.myDomain.com and with a Target set to myDomain.asuscomm.com.
Now ws.myDomain.com gets defined in the DNS and resolves to my Asus DDNS address. From there it gets forwarded to my Proxy server on 192.168.1.62 and directed to 192.168.1.64:80 by means of the VirtualHost definition. And with additional CNAME record definitions for other hosts, you can define additional VirtualHosts in the Proxy server to access other machines and resources. Neat!
Cheers!
I have a website that use wildcard-subdomain to change languages. I work fine in localhost.
When I upload to server, the default pages work fine but when I switch to English like this
nghiemthu.net to en.nghiemthu.net
only appear the message:
Apache is functioning normally
Please help.
You should have somewhere in /etc/httpd/ a file with ServerName nghiemthu.net (probably inside a <VirtualHost *:80>).
You need to declare the other domains to serve with ServerAlias.
Here, it seems (you didn't post your configuration so I'm guessing) the request doesn't match any virtual host and goes to the default one (serving the default html file).
See also ServerName and name-based virtual hosts.
If you haven't already activated your SSL certification, then activate it.
If you have already activated your SSL certification, then remove it.
I have a development server running Centos 7 I've setup in my living room. As of now I'm not using a domain, my ISP blocks port 80 so I've got Apache listening on port 8080.
I have a few different sites on here I've been playing with. One of them is a redmine installation, another is wordpress, and the other has dolphin on it. I can get any one of these 3 to run normally off the root ip xxx.xxx.xxx.xxx:8080 but when I try to setup an alias it points to the server's local ip. This works great from home, but I can't access them anywhere else.
I've setup a virtual host configuration in apache like this:
<VirtualHost *:8080>
DocumentRoot /var/www/html/wordpress
Alias /wordpress /var/www/html/wordpress
</VirtualHost>
When I open xxx.xxx.xxx.xxx:8080/wordpress it tries to redirect to the local ip 192.168.1.xxx:8080/wordpress I feel like I'm on the right track but I'm not sure where to go from here. Thank you.
I stumbled upon the solution today after running into something similar with a site I migrated for a client today. I was sure it had to be an apache issue.
The WP installation (and others) were pointing to my private IP as I'm not using domains for any of them. This is why I kept having the site redirect.
192.168.* are private network addresses. And by definition "IP packets addressed from them cannot be transmitted through the public Internet".
You have to get yourself a public IP or use a service like https://ngrok.com/.
Alias directive itself shouldn't cause redirect. There is something else (probably some Wordpress setting or .htaccess redirect) that is causing that when the page is opened (or not found)