Can you help me? I have two servers with all permissions in CentOS, assigned IPs, and a subdomain that pointing to one, where there a static website. But, the other server has a blog on Wordpress. The question is how pointing from a folder to another server. Thus:
subdomain.domain.com >> IP: 1.2.3.4
subdomain.domain.com/blog >> ANOTHER: 2.3.4.5
Your best bet is to use something like mod_proxy to reverse proxy requests for blog related resources to your WordPress Server.
So something like:
<VirtualHost *:80>
ServerName subdomain.domain.com
DocumentRoot /whatever
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /blog http://2.3.4.5/blog
ProxyPassReverse /blog http://2.3.4.5/blog
#...
</VirtualHost>
One more point to mention, in the example above I reverse proxying to a resource identified by the hosts IP address. I would strongly recommend using a hostname and DNS instead since DNS is a good thing:
ProxyPass /blog http://blog.domain.com/blog
ProxyPassReverse /blog http://blog.domain.com/blog
Obviously you''l need to add 2.3.4.5 to DNS (or host hack accordingly)
Related
I'm trying to run Gogs.io on an apache webserver along with a standard website, and I'm trying to have Gogs.io used on a subdomain rather than using my standard domain with a port.
Gogs.io runs on port 3000, and I want the url to be
http://gogs.example.net/
Rather than
http://example.net:3000/
Both my public IP with port and example.net:3000 work, but when trying to use gogs.example.net, I always get an AT&T DNS Error Assist page. I'm not sure what I'm doing wrong, as I had it working earlier until I tried to change the name of the subdomain in my apache config, but I changed it back when I started having issues, to no luck.
Here is my Apache config for the page:
<VirtualHost *:80>
ServerName gogs.example.net
ProxyPreserveHost On
ProxyPass / http://example.net:3000/
ProxyPassReverse / http://example.net:3000/
</VirtualHost>
This may be impossible, but any help would be greatly appreciated!
Fixed the issue by adding an A record to my domain
A Record: git -> 111.222.333.444
As well as modified the VirtualHost settings to include the subdomain in the ProxyPass and ProxyPassReverse
<VirtualHost *:80>
ServerName gogs.example.net
ProxyPreserveHost On
ProxyPass / http://git.example.net:3000/
ProxyPassReverse / http://git.example.net:3000/
</VirtualHost>
I'm using WSO2 API Manager. I have fronted API Manager(tomcat) with an Apache HTTP Server.
For the URL api.abc.xyz.lk a public IP has been assigned. For that public IP a local IP which is 192.168.6.162 has been assigned. I have added a virtual-host to redirect all the http://api.abc.xyz.lk to http://192.168.6.162:9763/store.
What I'm trying to do here is redirect all the http://api.abc.xyz.lk requests to http://192.168.6.162:9763/store.
Below is the virtual-host block I use.
<Virtualhost *:80>
ServerName api.abc.xyz.lk
ServerAlias api.abc.xyz.lk
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://192.168.6.162:9763/store
ProxyPassReverse / http://192.168.6.162:9763/store
</Virtualhost>
The problem is
the URL that works is as below
http://api.abc.xyz.lk:9763/store
But actually what I want is
http://api.abc.xyz.lk
How can I fix this?
you need to modify this proxy pass
ProxyPass /store http://192.168.6.162:9763/store
ProxyPassReverse /store http://192.168.6.162:9763/store
this will do the trick..
make sure to enable the proxy ports in server, you can configure proxy ports by editing "catalina-server.xml" in $UES_HOME/repository/conf/tomcat/catalina-server.xml
I have a web site on EC2 running with tomcat(8080), and in the same instance I have apache2 (80) to give statical files (image) to a android app. I need both, but it's not neccesary that it collaborate.
Well, my question is if I have this url : http://ec2-54-72-116-252.eu-west-1.compute.amazonaws.com:8080/OcioTurismoMontoro
How can I redirect my www.montoroturismo.tk to it?
In the domain panel I only can put the ip of my hosting but neither the port either the context (/OcioTurismoMontoro) .
Please, help me.
You will have to manage port forwarding on the instance itself. If you want to serve something else on port 80, may be you can create virtual host on Apache. Put this in <Apache>/conf/sites-enabled/OcioTurismoMontoro.conf:
<virtualhost *:80>
ServerAdmin webmaster#localhost
ServerName www.montoroturismo.tk
ProxyRequests off
<proxy *>
Order deny,allow
Allow from all
</proxy>
ProxyPass / http://127.0.0.1:8080/OcioTurismoMontoro/
ProxyPassReverse / http://127.0.0.1:8080/OcioTurismoMontoro/
</VirtualHost>
You will need mod proxy for Apache.
I have multiple urls coming into a server. I want to user host headers to redirect the traffic. I am trying to use Apache to redirect these requests to various servers that are inside our firewall. I have gotten part of the solution, but, I seem to be missing something.
For example, http://hostHeader1.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader1, and the result should be handed back to the client. http://hostHeader2.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader2. Etc.
Right now, I have the following, but, it redirects all traffic to http://hostHeader1Handler/:
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://hostHeader1Handler/
ProxyPassReverse / http://hostHeader1Handler/
ServerName hostHeader1.mycompany.com
</VirtualHost>
Any help appreciated.
Scott
This is probably your first or your only virtual host. Just add another virtual host before. Then this should be the new default.
NameVirtualHost *:*
<VirtualHost *:*>
ServerName your.default.domain.de
DocumentRoot /var/www/pathToHTML
</VirtualHost>
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://hostHeader1Handler/
ProxyPassReverse / http://hostHeader1Handler/
ServerName hostHeader1.mycompany.com
</VirtualHost>
I'm having trouble with making a subdomain to my Windows computer while using AJP to proxy to Tomcat. This is what I have in my httpd.conf file:
<VirtualHost *:80>
ServerName subdomain.localhost
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://localhost:8009/folder/
ProxyPassReverse / ajp://localhost:8009/folder/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
The subdomain has been added to `c:\windows\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 subdomain.localhost
When I go to http://localhost i goes straight to the proxy. When I go to http://subdomain.localhost i goes to the proxy as well. How do I make is so the subdomain only goes to the proxy and the regular goes to Apache?
You need to declare a second VirtualHost with localhost as the ServerName.
This should probably be moved to superuser.com but one thing to try:
<VirtualHost *:80> informs it to accept all incoming connections on port 80 to use these settings. I would try changing it to say:
<VirtualHost subdomain.localhost:80>
and see if that only applies these settings when the subdomain is used.
The ServerName tag that you put with the subdomain doesn't tell it who to listen for. The official documentation states:
The ServerName directive sets the
hostname and port that the server uses
to identify itself. This is used when
creating redirection URLs. For
example, if the name of the machine
hosting the web server is
simple.example.com, but the machine
also has the DNS alias www.example.com
and you wish the web server to be so
identified, the following directive
should be used:
You can read more on these configurations here.