Apache route subdomain to nginx on port? - apache

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

Related

Apache and Yarn ports

I want to configure both apache and yarn servers on the same machine. Default web port is 80 and 443 for ssl as far as I know.
Is that possible for both services to share the same ports? What I need is:
http(s)://example1.com - go to apache server
http(s)://example2.com - go to yarn
I know I can configure it so I call:
http(s)://example1.com:3000 or other port. It's not intuitive for users however.
Or... make htaccess rule to redirect example1.com:80 to example1.com:81 for example? Or somehow internally redirect from apache to yarn...? :)
I'm pretty newbie in configuring servers... I always used default settings and vhosts and it was just enough. In fact I've never work with yarn at all so any advices will be appreciated.
Solved:
apache in vhosts configuration is redirecting specific domain traffic from :80 to :3000 and node is run on 3000 port.
In my opinion you can using haproxy or squid proxy, to loading balancing, or you can set on domain server to set pointing the domain, but you must set other port on of app, on this case we must try to easy access without type the port on the address bar

apache redirect to SSL configured site

I am trying to setup a gitlab repository and I am quite new to the web server side of things. My setup is the following:
I have an apache server which is running my main website on port 8080.
I have the gitlab configured with SSL and Nginx and running on port 2443.
At the moment, the gitlab site can be accessed through https://www.example.com:2443.
What I would like to do is setup a redirect through my apache server where if someone comes to http://www.example.com/gitlab or https://www.example.com/gitlab, they get redirected to ``https://www.example.com:2443` (preferably without the web browser text field changing).
Could this be done easily with Apache? Also, since the redirect is to an SSL site, any special things we need to consider?
You can try adding the redirect directive to your Apache VirtualHosts (8080 and 443).
Redirect permanent /gitlab https://www.example.com:2443

Apache HTTPD VirtualHost issues on port 443

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.

Nginx, Apache and Plesk

I am currently trying to take some load of my Apache web server.
The idea is to let nginx handle the static files.
The procedure is simple nginx pass-> 8080 to Apache.
There is just one problem.
The server has Plesk installed, and Plesk handles the vhosts with the .include files in every vhost folder/config.
Every vhost has an different port and setup in his own .include file, and that makes it impossible to change the Apache port to 8080 on a global level.
Any ideas?
As mentioned, it's better to use latest plesk 11, because it has native nginx support and it's actually stable now.
Since Plesk 9.5 appears ability to change apache ports through /usr/local/psa/admin/bin/websrvmng check for --set-http-port and --get-http-port in this pdf
Since Plesk 10.2 there is ability to change apache port on global level through plesk database http://kb.parallels.com/11232

How do I redirect from Apache to Tomcat?

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