TeamCity behind an Apache proxy server - apache

I have installed latest TeamCity 9, now I want to access it from the public Internet via HTTPS. So I followed the instructions to setup TeamCity behind an Apache proxy server, as described in the official docs.
Now when I try to access the TeamCity server in the browser I get a 404 page from the Tomcat server. I am not sure what I did wrong, but the issue might be related to the /tc sub folder I have moved the content ROOT into (as described in the docs).
When I connect directly from the server to http://localhost:8111/tc I get exactly the same 404 message.
I feel a bit lost here.
Any ideas where I should look for the error?
PS: When I move the content ROOT back into the original folder, and set the Apache proxy accordingly, then it works fine. So the issue is indeed related to the /tc sub folder.

This is what worked for me
Step 1: I installed teamcity at the port 8080
Step 2: Moved all contents of <teamcity_home>\webapps\ROOT\*.* to <teamcity_home>\webapps\teamcity
Step 3: Created <Apache_Home>\conf\extra\httpd-teamcity.conf with the following contents
ProxyRequests Off
ProxyPass /teamcity http://localhost:8080/teamcity connectiontimeout=240 timeout=1200
ProxyPassReverse /teamcity http://localhost:8080/teamcity
Step 4: Added the following to <Apache_Home>\conf\httpd.conf file
#Include TeamCity Settings
Include conf/extra/httpd-teamcity.conf
and uncommented the following
# Modules to load to redirect teamcity
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Step 5: Accessed Teamcity via http://localhost:8080/teamcityORhttp://localhost/teamcity
Note: you can no longer access teamcity via http://localhost:8080
And update the configuration of your agent to point to the new server location.

Related

Apache2.4.27 could not find ssl_module in mod_ssl.so

I am trying to setup a local https server using Apache2.4.27.
I have followed the instruction given on this website how to setup SSL on Apache.
When I uncomment LoadModule ssl_module libexec/mod_ssl.so on my Apache httpd configuration, I got the following error when I tried to restart my Apache server:
httpd: Syntax error on line 141 of /usr/local/etc/apache2/2.4/httpd.conf: Can't locate API module structure `ssl_module' in file /usr/local/opt/httpd24/libexec/mod_ssl.so: dlsym(0x7fe0a1c07080, ssl_module): symbol not found
I have confirmed that there is mod_ssl.so file inside my httpd's libexec folder.
I wonder where did I go wrong, since fresh installation of openssl and apache could not help me to solve this problem.

How to setup glassfish 4.1.1 behind apache on Ubuntu 16.04 server

I want to setup Apache and Glassfish on Ubuntu 16.04 server.
I have installed
apache2
libapache2-mod-jk
glassfish
The following are the steps I have followed
Configuring the MPM module
Set MaxRequestWorkers to 400 in /etc/apache2/mods-available/mpm_event.conf
Configuring the JK Module
<IfModule mod_jk.c>
JkWorkersFile /usr/share/glassfish4/glassfish/domains/<domain-doamin1>/config/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMountCopy all
</IfModule>
JkMount /myapp/* ajp13
<Location "/myapp/WEB-INF/">
require all denied
</Location>
Create a workers.properties file in your GlassFish domain's config directory
worker.list=ajp13
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
# load balancing only: worker.ajp13.lbfactor=50
connection_pool_size=10
connection_pool_timeout=600
worker.ajp13.socket_keepalive=False
worker.ajp13.socket_timeout=30
Create the JK listener in GlassFish using these commands
asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-listener
asadmin set server-config.network-config.network-listeners.network-listener.jk-listener.jk-enabled=true
then I restarted glassfish domain successfully but when i try to restart apache2 with sudo /etc/init.d/apache2 restart I get the error below
[....] Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
This error occurs when I edit the file jk.conf located under /etc/apache2/mods-available/jk.conf
Where am I going wrong. Is there a complete guide to accomplishing this? Finally the newer apache2 doesn't have the file httpd.conf and all the tutorials allover the Internet rely upon this file. Thanks in advance.
Since your objective is just to forward requests from Apache to GlassFish, not to loadbalance requests from Apache to multiple GlassFish servers, I would recommend avoiding mod_jk. You can certainly achieve your goal with it, but if you are new to the concepts involved, you will find it difficult to understand and maintain.
Instead you can use mod_proxy and, optionally, mod_proxy_ajp.
First, a definition:
AJP vs HTTP
AJP is a protocol like HTTP, but binary rather than text based. It has no secure/insecure options like HTTPS/HTTP since it is normally used behind a firewall and performs much better than HTTP for these scenarios. When you mark any GlassFish network listener as jk-enabled, you are enabling AJP communication, rather than HTTP.
You've installed Apache via the ubuntu apache2 package which has its own example structure to configuration which is different to the layout you would get if you downloaded and unzipped it. This has advantages, but we need to understand the Apache configuration file before getting to that.
Apache Configuration
Generally, you will see internet guides refer to httpd.conf as the configuration file to edit. This is just the default "parent" configuration file. In Debian/Ubuntu systems (and their derivations, like Linux Mint), the file to look for is apache2.conf.
This file is read, and its directives applied, from top to bottom, so if you have set the same property to two different values, the second will apply. (More accurately, they will both apply but the first will only apply until the second setting is read).
This file can also specifically "include" files and folders (where any *.conf file in an included folder will be included). These will be read in and merged with the main configuration at the point where the "include" statement is written. So the very last line in the main configuration file (if it is not specifying another file) will be the last line of configuration to be set, no matter what.
Debian config layout
I would highly recommend you read the opening comment in the apache2.conf file, since it will tell you all you need to know about the layout. Suffice it to say that keeping all the config in one file is very painful to maintain. The Debian package separates configuration into three categories:
sites
Sites are single configuration files for a website or web project. This could be anything: PHP, static HTML or a Java EE application deployed to an app server like GlassFish.
mods
Modules are subdivided into *.load files which load the actual libraries needed to run them, and *.conf files which have global configuration for the modules. Note that this configuration applies to every site that uses the module, so it is best to put any site/app specific module configuration in the appropriate site.conf file
conf
These files are just for any other general configuration which fits into a nice group. This could be SSL configuration like keystore and truststore locations.
When you look at the directory structure, you will see that each of these have 2 folders: *-available and *-enabled. This is because the Debian Apache package comes with 6 helper tools, a2ensite and a2dissite; a2enmod and a2dismod; a2enconf and a2disconf. The idea is that you follow these rules:
Never directly edit the apache2.conf file
only ever add or change files in the *-available folders
Use the helper tools to enable or disable sites/modules/conf files.
Answer
So to (finally) answer your question, I would do the following steps:
Enable mod_proxy_ajp
a2enmod mod_proxy_ajp
Create a new myApp.conf in sites-available. You can copy the default one, which is a good example. Assuming you have just want to forward all requests to GlassFish, you can use the default VirtualHost settings of ` which will process a request for any hostname on port 80. Use port 443 if you want to add HTTPS.
Add ProxyPass and ProxyPassReverse directives to the location of your server. If Apache and GlassFish are on the same server, it is likely you will want to use ajp://localhost:8080
ProxyPass / ajp://host_name:0000
ProxyPassReverse / ajp://host_name:0000
Note: This assumes you are using AJP. If that causes you problems, switch to HTTP by changing ajp to http above and disabling the jk-listener in GlassFish.
Once you have completed your myApp.conf configuration, remember to disable the default site:
a2dissite 000-default-site.conf
And enable your new site:
a2ensite myApp.conf
Those commands will appropriately modify the main apache2.conf and create the appropriate links in the sites-enabled folder.
That should be all you need. Now, everything that points to your hostname after the root / of the URL will be forwarded to the root context / of GlassFish.

Apache HTTP Server stopped working when using "https://" in xampp localhost

Google chrome update their security. how to enable HTTPS:// in xampp?
1) There is the config file xampp/apache/conf/extra/httpd-ssl.conf which contains all the ssl specific configuration. The files starts with <IfModule ssl_module>, so it only has an effect if the apache has been started with its mod_ssl module. Open the file xampp/apache/conf/httpd.conf in an editor and search for the line
#LoadModule ssl_module modules/mod_ssl.so
remove the hashmark, save the file and re-start the apache.
2) Also if you your document root is not properly configured than it might give you permission denied error. check for DOC ROOT
Check the highlighted text
I found this here. Refer to this for any help.

URL redirection using .htaccess

My website is deployed and running on apache server from enomcentral hosting environment with only limited access so i can't change any configuration setting except htaccess file. Also another application running on tomcat in different domain server with full admin access.
e.g - www.example.com is running on enomcental. and tomcat application running on www.abc.com/xyz.
I want to access tomcat application, running on different domain ,using the url www.example.com/xyz.
so when I enter Url www.example.com/xyz the URL remains same but the content should be comes form www.abc.com/xyz i.e., tomcat server example/
URL redirection changing the browser URL.
I can only change ion .htaccess file.
mod_jk.so configuration not allowed.
What you need is mod_proxy, if enabled,
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
then, this rule will work.
RewriteRule ^xyz$ http://www.abc.com/xyz [P]
P means proxy, docs here.
But if mod_proxy is disabled, then could you make the /xyz point to some cgi(e.g proxy.php), which is under your control, and make the cgi read content from http://www.abc.com/xyz?

JSP with Apache/2.2.17 (Ubuntu)

I'm running a Ubuntu Sever with Apache/2.2.17. I can't seem to run JSP I just get the source code in the browser. What am I doing wrong?
Thanks
What am I doing wrong?
Expecting that Apache HTTPD magically supports JSP. It doesn't. You need Apache Tomcat instead.
See also:
Our JSP wiki page - at the bottom you can find several tutorial links to get started properly.
Try this
1)get the mod_jk.so
2)include this in httpd.conf file
LoadModule jk_module modules/mod_jk.so
3)Then in virtual host section of httpd.conf
JkMount /test/*.jsp loadbalancer
put your jsp file in webapp dir in the tomcat directory. Run as localhost:8080/your.jsp from your browser. Also make sure tomcat is set properly by running localhsot:8080 form your browser.