I have just started using lighttpd and I am trying to configure it to act as a reverse proxy to an Apache server running on 127.0.0.1 on port 8080. I have multiple wordpress blogs running on the same host
127.0.0.1:8080/blog1
127.0.0.1:8080/blog2
I have just bought a domain name www.mydomain.com and I would like to requests to blog1 to appear like this
www.mydomain.com/article1 even though on my server this translates to 127.0.0.1:8080/blog1/article1
What I am after is an example of lighttpd.conf configuration that will redirect requests from www.mydomain.com that arrive on port 80 to be redirected to 127.0.0.1:8080/blog1.
Can anyone help me?
Update: lighttpd 1.4.46 (released in 2017) has proxy.header which allows limited rewriting of the url prefix when proxying. See lighttpd mod_proxy
Related
I want to achieve the following:
My app services user requests like so:
user request www.mysite.com -> Apache reverse proxy -> 192.168.1.1:8080/myApp
My app also makes requests but I want to route through a proxy:
192.168.1.1:8080/myApp -> Apache forward proxy -> www.google.com
Can I set this up on the same Apache server? If not, can I do it with two Apache servers on the same system?
My solution is to set up two virtual hosts in apache with different ports, one acting as a reverse proxy and the other, a forward proxy.
One conf file contains ProxyRequest on which makes Apache work as Forward-proxy and put ProxyRemote to localhost:high-port, and another conf file contains VHOST block for each port with ProxyRequest off which make Apache as Reverse-proxy.
I have a site with two servers, apache2 and Tomcat7.
Apache2 listens to 80, while tomcat7 to 443.
Apache2 is needed to present a Wordpress blog, while Tomcat7 to serve a JSP site.
My virtualhosts scheme in Apache is like this:
http://blog.example.com ---> DefaultRoot for the blog
http://example.com ---> Redirect to https://example.com (where Tomcat listens)
Everything works fine. My original site in JSP always responds in https secure mode, while I have a working Wordpress in my "blog." subdomain.
The problem comes now that I want that blog interact with https (without any ugly 3rd port in the url if possible)
Making Apache2 to listen at 443 will obviously come to a conflict about 'port in use'.
Disabling it in Tomcat7 has no sense as somewhere it has to listen for ssl.
The question for you is: How would you face it?
I have a server running CentOS 7 that has an Apache web-server running on port 80. I am also using a common open-source Git project called GitLab, which uses the nginx web-server instead of Apache. I have configured GitLab's nginx to run on port 4444.
I have a subdomain "git.mydomain.com" that I would like to forward to "mydomain.com:4444" however I would like the URL to continue saying "git.mydomain.com".
I belived that I need to have an Apache VirtualHost file, however I'm not sure what to do.
Is this possible? If so, how can I do so?
Thanks
You would indeed need a git.mydomain.com VirtualHost with a proxy/reverse proxy directive. See https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
I'm trying to setup Apache HTTPD to work with Tomcat. Right now I have tomcat up and running and it is working fine (can access the web application by specifying the :8080 in the url). What I want to do is have Apache HTTPD redirect port 80 traffic to 443, have SSL become established, then have it reverse proxy traffic to Tomcat. The port 80 traffic redirect works using the REDIRECT directive (redirecting to https:// www. myregistereddomain.com). For some reason the virtual host directive is not resolving for the 443 traffic. I get an "Invalid method in request \x16\x03\x01" followed by "File does not exist: /usr/local/apache/htdocs/501.shtml" in the apache error_log.
Link pertaining to issue: http://www.noah.org/wiki/Apache2_Invalid_method_in_request_%5Cx16%5Cx03%5Cx01
I have tried change the virtual host to _default_:443 and *:443, but it still throws the same errors. There are no other VirtualHost directives in the httpd.conf file so i'm not sure how it is not resolving to that virtual host on 443. It was initially "www.mydomain.com:443" and then i tried it by "IP:443", but still same errors. Anyone happen to have any idea what is wrong with the setup or any pointers on how to proceed to troubleshoot it?
Ended up just using nginx. Was much easier to setup and get functioning as a reverse proxy.
I'm working on my first Java site. I'm running Apache Tomcat on port 8080, and Apache HTTPD on port 80. The current URL that I can access the site at is (for example) 123.4.5.6:8080. I want to remove the port number from the URL before I point the domain at the new IP.
At the moment I am only using Apache for phpmyadmin, however I plan on using it for CGI scripts and other stuff once I figure out mod_jk etc... So I don't want to change Tomcat's port to 80 and turn off Apache.
I hope this makes sense.
The correct way to do things is to leave Apache at 80 and Tomcat at 8080 and use a plug in (preferably mod_proxy) to proxy Tomcat from Apache. mod_proxy would only take you 10 minutes to set up.
This how-to is very simple to follow.
The usual way this is done, as you already mentioned, is to use mod_jk from Apache HTTPD to forward that content that you want to be processed by Tomcat.
There is a Quick HowTo at tomcat.apache.org. You need to do the following:
Copy mod_jk.so into the appropriate modules directory for Apache HTTPD.
Create a configuration file workers.properties
In Apache HTTPD's httpd.conf, add a section to configure mod_jk.
Ensure that Tomcat is configured to accept the mod_jk protocol, which is usually on port 8009.
The lines in httpd.conf with JkMount:
JkMount /examples/* worker1
tell Apache HTTPD which requests are to be forwarded to Tomcat.
Both the helpful answers above are good, but I much prefer mod_proxy over mod_jk. There's no extra installation to do for mod_proxy, unlike mod_jk, and the setup is much easier. mod_jk gives you more control over detailed tuning of Tomcat parameters, but if you just want a simple redirect from Apache to Tomcat, mod_proxy is the way to go.
If you want static content to be served by Apache instead of Tomcat you should use mod_jk : http://tomcat.apache.org/tomcat-6.0-doc/proxy-howto.html
And what about SSL - if we want Apache to handle HTTPS, because it is faster then java/Tomcat?
you should configure your tomcat using this link. for tomcat 7
http://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html