I've got an app which is running on JBoss 7. Its URL is http://localhost:8080/archive/app. How can I make it look http://localhost:8080/app or http://localhost/app?
PS. /archive means archive.war
1) Remove the welcome root. In the standalone.xml set:
<virtual-server name="default-host" enable-welcome-root="false">
2) Set the context root. In your archive.war add a jboss-web.xml file in the WEB-INF folder:
<?xml version="1.0"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
3) Set the http port to 80. In the standalone.xml change:
<socket-binding name="http" port="8080"/> to <socket-binding name="http" port="80"/>
Remember that if your server runs on a Linux machine it must be launched by root in order to use ports under 1024. In that case you can redirect from 80 to 8080 by means of iptables without the need to change the standalone.xml socket-binding
Related
I just installed Wildfly 11.0.0.Final on Amazon Linux with Java 8. How do I activate the AJP port in the $JBOSS_HOME/standalone/configuration/standalone.xml file ? I have the following configured for my socket bindings ...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" port="8009"/>
<!-- <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/> -->
<socket-binding name="http" port="${jboss.http.port:8081}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
However when I restart my server, although I'm able to connect to the http port, I can't connect to the AJP port ...
[myuser#mymachine ~]$ telnet localhost 8081
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
quit
HTTP/1.1 400 Bad Request
Content-Length: 0
Connection: close
Connection closed by foreign host.
[myuser#mymachine ~]$ telnet localhost 8009
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
What else do I need to do to activate my AJP port on Wildfly 11?
You'll need to activate it. See AJP Listeners for a bit more detail but the short answer is that you need to enable it:
[standalone#localhost:9999 /] /subsystem=undertow/server=default-server/ajp-listener=myListener:add(socket-binding=ajp, scheme=http, enabled=true)
This uses jboss-cli.sh to enable it. In this case myListener is whatever name you want. This will add an entry in the undertow section of standalone.xml that enables the listener. You'll need to restart to have this take affect.
I'm setting up a Service Fabric application which contains:
an Nginx instance as frontend (single instance, port 80)
some applications written with Asp.net core (1 website, some API services) (multiple instances, dynamic port)
a Gateway service for address resolution (single instance, port 8081)
For nginx, I'm using a solution available as Nuget package.
The gateway and, in general, the example to run .NET core app have been taken here
It is suggested by the .NET core team itself to host applications behind a real web server liken nginx.
Therefore I'd like to deploy my Service Fabric application with an instance of nginx as entry point, which redirects to the Gateway service, which will do the service resolution for the replicated stateless services.
My question is about the address that I need to use in the nginx.conf to point to the Gateway address. While trying locally, I can use the local address 127.0.0.1 and it works as expected, but what happens if on a real cluster my Nginx and Gateway instances are deployed to different machines?
This is my application manifest:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="SFApplicationType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="NginxPoC_InstanceCount" DefaultValue="1" />
<Parameter Name="Gateway_InstanceCount" DefaultValue="1" />
</Parameters>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="NginxPoCPkg" ServiceManifestVersion="1.0.0" />
<Policies>
<RunAsPolicy CodePackageRef="Code" UserRef="Admin" EntryPointType="All" />
</Policies>
</ServiceManifestImport>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="Gateway" ServiceManifestVersion="1.0.0" />
</ServiceManifestImport>
<DefaultServices>
<Service Name="NginxPoC">
<StatelessService ServiceTypeName="NginxPoCType" InstanceCount="[NginxPoC_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
<Service Name="Gateway">
<StatelessService ServiceTypeName="GatewayType" InstanceCount="[Gateway_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
<Principals>
<Users>
<User Name="Admin">
<MemberOf>
<SystemGroup Name="Administrators" />
</MemberOf>
</User>
</Users>
</Principals>
</ApplicationManifest>
and this is my current nginx.conf file:
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8081;
}
}
Update 2016-10-09
As requested in the discussion, I've created a test project here. Every contribute to the project is welcome.
f you deploy the nginx and gateway service to all nodes (InstanceCount = -1) you should be good. If the gateway service is down on one node, you would of course not be able to forward the request from nginx to a gateway service on another node. For this, you need the nginx service to look-up the gateway service.
You can get the service endpoint address for the gateway using a REST call: https://msdn.microsoft.com/en-us/library/azure/dn707638.aspx
I have a web application deployed on tomcat 7.0.23, and there are two connectors are set, almost default value.
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
compression="on"
compressableMimeType="text/xml"
address="SERVER_HOSTNAME" />
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="400" scheme="https" secure="true"
address="SERVER_HOSTNAME"
clientAuth="false" SSLProtocol="ALL"
SSLCertificateFile="/PATH/tomcat-server.crt"
SSLCertificateKeyFile="/PATH/tomcat-server.rsa"
SSLCipherSuite="ALL:!ADH:!SSLv2:!EXPORT40:!EXP:!LOW"
compression="on" compressableMimeType="text/xml"/>
After tomcat just restarts, both http:8080 and https:8443 work fine. While after a few days, the 8080 will not work, but the 8443 still works fine. The meaning of "8080 not work" is when using firefox to access the http:8080, some resources like js/css files will unavailable randomly.
In firebug, sometimes the A.js file will be shown as "Aborted", sometime the B.js will be shown as "Aborted". I tried to access one single file, like http://:8080/js/A.js file, the result is also random, sometime the full content can be shown in browser, sometime http request is aborted.
I also tried to increase the connectionTimeout to "60000", the only change thing is in Firebug, the aborted request was 0B but now is actual size. The only way to make 8080 work fine is to restart the tomcat.
Please someone tell me what's the cause or which way I should try? Thanks.
Another process might be taking the port 8080 somehow. And this process does not respond correctly to requests you address to Tomcat.
So, next time you see this issue, before restarting Tomcat, check which process the port 8080 currently belongs to.
On Linux I use the following command for this:
netstat -nlpt | grep 8080
One of the columns (the last one if I remember correctly) will be the ID of the process that consumes the port.
In case you have a Windows setup, use
netstat -ano | find "LISTENING" | find "8080"
Then find this PID in the Task Manager.
FYI: Windows Task Manager – showing the PID
I have a web app running in the following two setups: 1) JBoss running on Windows7 and 2) JBoss running with an apache httpd reverse proxy on CentOS.
I downloaded and added jbossWebService.jar to the WEB-INF/lib directory in order to use the org.jboss.web.tomcat.filters.ReplyHeaderFilter class. Following is my filter configuration.
<filter>
<filter-name>CommonHeadersFilter</filter-name>
<filter-class>
org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>
<init-param>
<param-name>X-Powered-By</param-name>
<param-value>MyWeb</param-value>
</init-param>
<init-param>
<param-name>Server</param-name>
<param-value>MyServer</param-value>
</init-param>
</filter>
In apache httpd conf file, I have the following, modifying which, did not have any effect as such.
ServerTokens ProductOnly
ServerSignature Off
What I see in the browser:
The JBoss without apache httpd shows the following:
X-Powered-By: MyWeb, JSP/2.2
Server: Apache-Coyote/1.1, MyServer
The JBoss with apache as reverse proxy shows the following:
X-Powered-By: MyWeb, JSP/2.2
Server: Apache-Coyote/1.1
What I want:
The Apache-Coyote/1.1 and the JSP/2.2 to go away. The one behind apache httpd does not even show MyServer as the server banner. I would like that to show up, but that's not a necessity.
Any help is appreciated.
Thanks.
Prajesh
Setting the system property org.apache.coyote.http11.Http11Protocol.SERVER seems to work in JBoss AS 7.1.1.Final
<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.SERVER" value="secretserver"/>
</system-properties>
Although be warned the system property mentioned above ('org.apache.coyote.http11.Http11Protocol.SERVER') is not present in the sys properties documentation for the latest version of JBoss Web, so if setting that property is not working then maybe it is missing from the version of JBoss Web you are using and writing a custom filter maybe the only option :(
http://docs.jboss.org/jbossweb/latest/sysprops.html
I installed RhodeCode 1.2.2 at a Windows 2008R2 (64Bit) box.
I had setup a IIS 7 as a Proxy Server (Application Request Routing + URL Rewrite) for RhodeCode running at 127.0.0.1:5000.
The Repository is reachable via "https://subdomain.domain.de".
At the repository summary, the Clone url points to:
https://[username]#127.0.0.1:5000/SomeProject
At the client side, I can clone the repository when replacing the
"127.0.0.1:5000" with "subdomain.domain.de".
For sure I would like that RhodeCode displays the Proxy url
("subdomain.domain.de") instead of the 127.XXX...
I search the web up and down and the only thing I found, was that
Apache has a "ProxyPreserveHost On" setting, which does the trick. However
I didn't found anything like that for IIS.
Is there somewhere a setting within the "production.ini" where I can
define the proxy url?
Or does someone found the well hidden setting within the IIS?
Any help is much appreciated :-)
thanks for your answer! I already use the ARR and setup the reverse proxy, I can access RhodeCode via the proxy. However, it looks like that the HTTP_HOST value is not forwarded to paster.
Within the IIS, I setup the following server variables and set them within the reverse proxy rule:
<set name="HTTP_HOST" value="[subdomain.domain.de]" />
<set name="HTTP_X_FORWARDED_SERVER" value="[subdomain.domain.de]" />
<set name="HTTP_X_ORIGINAL_HOST" value="[subdomain.domain.de]" />
<set name="HTTP_X_HTTP_HOST" value="[subdomain.domain.de]" />
<set name="HTTP_X_URL_SCHEME" value="https" />
but that have no affect at all.
At the linked previously answer, he suggested to copy these variable values back to the HTTP_HOST (within tomcat, should be paster in my case). That looks a bit overkilled to me, in comparsion to a simple "ProxyPreserveHost On" within apache. I have the feeling that I missed something here.
Cheers,
Sörnt
Itvan is correct, that will work.
Uncommenting the clone_uri will leave the default clone_uri. You can force the clone_uri to use your domain by having that line:
clone_uri = {scheme}://{user}{pass}[subdomain.domain.de]{path}
PS: Works on version 1.3.6
I'm working on out reverse proxying over https for rhodecode with apache on centos6 right now.
For Apache, the configuration noted by marcin of rhodecode fame is:
<VirtualHost *:80>
ServerName hg.myserver.com
ServerAlias hg.myserver.com
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
#important !
#Directive to properly generate url (clone url) for pylons
ProxyPreserveHost On
#rhodecode instance
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
#to enable https use line below
#SetEnvIf X-Url-Scheme https HTTPS=1
</VirtualHost>
For the IIS equivilent of ProxyPreserveHost, see Application Request Routing, which was provided in a previously answer by a MSFT MVP.
The http server is actually python paste's httpserver, so referring to the python paste documentation for httpserver (egg#Paste:http is familiar right), there is no proxy configuration. You will have to reverse proxy in IIS (source)
I am unsure why marcin has opted to advise setting up the reverse proxy versus utilizing paste's httpserver support for https; but having IIS field the requests, and binding paste's httpserver to 127.0.0.1 is likely best choice.
I've just installed RhodeCode 1.3.3 and got into this issue. You can edit this line in configuration file to make it work:
## overwrite schema of clone url
## available vars:
## scheme - http/https
## user - current user
## pass - password
## netloc - network location
## path - usually repo_name
#clone_uri = {scheme}://{user}{pass}{netloc}{path}
clone_uri = {scheme}://{user}{pass}yourdomain.com{path}