I am fairly new to AWS and have been trying to solve a problem. The problem statement; the company i work for currently have a cloud subscription with Atlassian for Jira and Confluence products. They want to move to a self-hosted license and so asked me to see what could be done.
I did the following steps:
Setup an Amazon Ec2 Instance
Associated an Elastic IP
In Route 53 I created a zone and did the necessary with Go Daddy to add name servers.
I installed Jira on the EC2 instance
I installed Confluence on the EC2 Instance
Now for the sake of this let's say my instance domain is ec2compute.amazonaws.com. Jira installed on port 8080 and confluence on 8090. If I navigate in my browser to ec2compute.amazonaws.com:8080 and ec2compute.amazonaws.com:8090 I get to the setup pages of Jira and Confluence.
So working as expected so far. Except I want to use my own domain - more importantly a sub-domain for Jira and a sub-domain for Confluence.
Going back to my domain, as I said i set the domain up lets say example.com in Route 53 and did the go daddy nameserver assignment. I installed apache on Ec2 and now if i go example.com i get the apache welcome page on my server...and if i go to example.com:8080 I get to the jira page and example.com:8090 i get to the confluence page.
What I want to do though is point jira.example.com to get to the jira page and confluence.example.com to get to the confluence page. I have tried updated the httpd.conf file with a virtual host for each but with no success.
Can someone please point me in the right direction ?
This should do (you can put it at the bottom of the httpd.conf or, even better, as separate .conf file in conf.d subfolder:
<VirtualHost *:80>
ServerName confluence.example.com
ProxyPreserveHost On
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
</VirtualHost>
<VirtualHost *:80>
ServerName jira.example.com
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
Use proxies when installing Confluence and Jira on the same server. To actually configure Confluence and Jira at separate urls, you'll also edit each app's server.xml (among other things). Atlassian has documents that instruct on Using Apache with mod_proxy and Proxying Atlassian server applications with Apache HTTP Server.
Related
I've installed Tomcat 9.0.27 on my Digital Ocean droplet running Ubuntu 18.04.3.
I deployed my Java WAR on Tomcat and am able to access it on the URL:
http://example.com:8080/app_name
I want to be able to directly access my WAR serving JSP through my domain.
So, when I hit example.com it directly serves my Java application.
I have tried several links to do the same. According to one of them (https://www.digitalocean.com/community/questions/how-to-tie-domain-name-with-application-running-on-tomcat), I did the following steps:
1. Enabled "proxy" and "proxy_http" using a2enmod
2. Restarted Apache2 service using systemctl restart
3. Created a new virtual host in a file named /etc/apache2/sites-available/tomcat.conf with the following contents:
<VirtualHost *:80>
ServerName www.example.com
ProxyRequests On
ProxyPass / http://localhost:8080/app_name/
ProxyPassReverse / http://localhost:8080/app_name/
</VirtualHost>
Enabled 'tomcat' site using a2ensite
Restarted Apache2 service using systemctl restart
Now when I hit example.com it does serve my homepage but all the CSS styles and images seem to be broken. The hyperlinks also don't work anymore.
My application is still being served at example.com:8080/app_name and on this URL everything works perfectly.
Please help me out with this.
Fixed this by renaming my webapp to "ROOT" and copying it to Tomcat.
Now the redirection is to http://localhost:8080.
I have an apache server with a bought domain.
I want to know if it is possible to redirect some web pages... For example
I have a NextCloud Server that I want to access by www.example.com/nextcloud
And a plex server I want to access by www.example.com/plex
PD: I don't have the possibilities of subdomains like www.plex.example.com because I didn't hire it when I bought the domain
Is this possible? How do I need to configure apache virtualhost? Thanks!
You mention that you want to access by www.example.com/nextcloud and by www.example.com/plex. I will therefore take for granted that you do not want the site address to change in your client's browser. So no redirection here. Redirection would change the address bar value.
Then the option you want is a reverse proxy. It will "hide" the fact that the client is being served pages by another site or application.
Assumptions:
You have system 1 with an Apache server that responds to http://www.example.com
You have system 2 with an application that responds to http://www.domain1.com/nextcloud.
You have system 3 with an a plex application that reponds to http://www.domain2.com/plex
Therefore on system 1, in the configuration file for your Apache (most probably httpd.conf), you will:
load the proxy modules
add these lines in your <VirtualHost>:
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
[... SOME OTHER CONFIG ...]
ProxyPass "/nextcloud" "http://www.domain1.com/nextcloud"
ProxyPassReverse "/nextcloud" "http://www.domain1.com/nextcloud"
ProxyPass "/plex "http://www.domain2.com/plex"
ProxyPassReverse "/plex" "http://www.domain2.com/plex"
[... SOME OTHER CONFIG ...]
</VirtualHost>
Now domain1.com and domain2.com can be IP addresses, but using dns is so much better for flexibility. Adjust this sample as required.
Complete mod_proxy documentation: https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
I have multiple applications running in Oracle APEX 5. They are served through ORDS and Weblogic 12.2. Then a web front end to serve the reverse proxy. It may sound dumb, but that's what we were tasked to do. I used mod_proxy to get the reverse proxy going, but I'm having issues hiding the application number. The original url is devapp101.cloud.com:7003/ords/f?p=101 . What I want users to navigate is devapex.cloud.com what I have is devapex.cloud.com/ords/f?p=101 . Here is the config I've got right now. What can I do to have users only use devapex.cloud.com?
###devapex.cloud.com
<VirtualHost *:80>
ServerAdmin admin#cloud.com
ServerName devapex.cloud.com
ErrorLog logs/devapex.error_log
CustomLog logs/devapex.access_log common
### re-direct to the appropriate server
ProxyPreserveHost On
#RequestHeader set WL-Proxy-SSL true
ProxyPass / http://devapp101.cloud.com:7003/
ProxyPassReverse / http://devapp101.cloud.com:7003/
</VirtualHost>
I've looked at mod_rewrite, but I'm not seeing how that can do what I want to happen. Please excuse my noobness here, but I've searched everywhere for this scenario, and I have not found it anywhere.
You need to configure 'Oracle WebLogic Server Proxy Plug-In' to proxy requests from web front end to WebLogic.
Check the document :
https://docs.oracle.com/middleware/1221/webtier/develop-plugin/toc.htm
What is your web front end to serve the reverse proxy?
Check the documents to match the middleware of your web front end.
(If 'Apache HTTP Server', check 'Configuring the Plug-In for Apache HTTP Server'.)
I am trying to access the yacceleratorstorefront/electronics/en/?site=electronics URL from apache web server to Hybris where the electronic store URL is configured. The electronic store URL is accessible and working from any of the server in environment if apache web server is BY PASSED
http://10.0.1.141:9001 is my Hybris server.
ERROR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTTP Status 500 - Cannot find CMSSite associated with current URL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
type Status report
message Cannot find CMSSite associated with current URL
description The server encountered an internal error that prevented it from fulfilling this request.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Any suggestion or advice is highly appreciated. Thank you in advance.
-Regards, S#BS
------------------------------------------------httpd Code below----------------------------------------------------
<VirtualHost *:80> ProxyPreserveHost On
ProxyPass / http://10.0.1.141:9001/ ProxyPassReverse / http://10.0.1.141:9001/
ServerName localhost</VirtualHost>
<VirtualHost *:443> ServerName localhost
#ProxyRequests Off #ProxyPreserveHost On ProxyPass / https://10.0.1.141:9002/yacceleratorstorefront/electronics/en/?site=electronics ProxyPassReverse / https://10.0.1.141:9002/yacceleratorstorefront/electronics/en/?site=electronics
SSLEngine on SSLCertificateFile /etc/httpd/certs/mysite.com.crt SSLCertificateKeyFile /etc/httpd/certs/mysite.com.key
</VirtualHost>
The error message indicates that you are not setting the ?site=electronics parameter at the http version of you proxy (it also seems to be missing in the proxypass setting for port 80).
I'm not an apache buff but maybe it works if you configure your proxy settings for port 80 in the same way:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://10.0.1.141:9001/?site=electronics
ProxyPassReverse / http://10.0.1.141:9001/?site=electronics
ServerName localhost
</VirtualHost>
Just some more info: Apart from the site parameter approach you can also use a host name approach.
Not sure if you have access to the hybris wiki, but here are some more details:
https://wiki.hybris.com/display/pmtelco/Using+Modulegen+to+Create+a+B2C+Telco+Setup#UsingModulegentoCreateaB2CTelcoSetup-AccessingtheStorefront
(its for Telco accelerator, but it works the same for any other storefront).
Not sure how that works together with apache, I assume you have to setup some sub domains or something.
Does it work if you try to access apache on https directly? (There it seems you have the correct url containing the site parameter).
Note: The site parameter is basically only needed for the first http request of a session. It is used to determine which storefront, i.e. BaseSite is supposed to be used. All subsequent requests (of the same session) shouldn't require the site parameter.
Hope that helps!
Your http config is fine. Your https config is wrong.
Do not put ?site=electronics or anything like that in your apache config.
The site detection works based on the URL. In the sample data you are using that is at least a regex looking for "electronics" in the hostname.
One single apache config will be able to support all sites. You do not need to specify the site. You do not need to specify /yacceleratorstorefront.
Simply edit your hosts file to include "10.0.1.141 electronics.rtfm"
Now access http://electronics.rtfm/
You can avoid adding the site in the URL by going in HMC: WCMS > Websites
Under the Properties tab, add a new URL pattern that will match your site.
Once it is done, URLs that match the site's pattern will automatically use that site.
Using URL patterns for each site will simplify the web server's configuration.
What I'm basically trying to accomplish is having my main website running a CMS written in Go. This will be located at www.example.com.
I also have applications written in PHP located in directories, such as www.example.com/clients/
How can I serve example.com/clients using Apache/PHP while serving example.com using Go built-in web server?
Via mod_proxy in Apache2, you can proxy different paths into different destinations at localhost or anywhere else accessible by your server, including within your local network (if your server can access it).
For this you would use ProxyPass (Apache2 Docs for ProxyPass, which is very useful reading) like the example below:
<VirtualHost *:80>
ServerName some.example.host.xyz
DocumentRoot /var/www/your-document-root
Alias /clients/ /var/www/clients/
ProxyPass /clients/ !
ScriptAlias /something-using-cgi/ /var/www/cgi-stuff/
ProxyPass /something-using-cgi/ !
ProxyPreserveHost On
ProxyPass / http://localhost:9876/
ProxyPassReverse / http://localhost:9876/
ProxyPass /elsewhere/ http://elsewhere.example.host.xyz:1234/
ProxyPassReverse /elsewhere/ http://elsewhere.example.host.xyz:1234/
</VirtualHost>
You'll want to be sure that you set your proxy security such that external users can't use your reverse proxy as a forward proxy, too. You can do that via ProxyRequests as described in the official Apache2 docs. The way I did this on a server is to put this in your server-wide config (you should verify on your own that this is secure enough):
# disables forward proxy
ProxyRequests Off
Andrew Gerrand has a good blog post about this for nginx but the principle is the same for Apache.
You want to set up Apache as a reverse proxy for requests coming in for the Go application.
For Apache you want to look at mod_proxy