I have a Java application that uses Wildfly 16, on dedicated Linux server, running WHM CentOS 6.10. The application works on the IP Adresss port 8080.
The Apache 2.4 is installed and running. I was told Apache uses port 80 which the domain name resides on. I can see from the domain URL the boilerplate index.html page which is under public_html but do not the WildFly index page.
The IP address port 8080 does show the WildFly index page. Which needs to be shown using the domain name.
I tried the following:
./bin/standalone.sh -Djboss.http.port=80
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service org.wildfly.undertow.listener.default: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: Address already in use /127.0.0.1:80
Within the standalone.xml I changed the following:
<socket-binding name="http" port="80"/>
Unfortunately I do not know a way to post all of the error but I am able to submit the following:
ERROR [org.jboss.as.controller.management-operation] – failure description: "WFLYCTL0080: Failed services" => "org.wildfly.undertow.listener.default"
INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start ‘default’ listener.
Tried again in standalone.xml by changing the following:
<socket-binding name="http" port="${jboss.http.port:80}"/>
ERROR [org.jboss.as.controller.management-operation] WFLYCTL0013: Operation ("add") failed -address:
- failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.undertow.listener.default" => "WFLYUT0082: Could not start ‘default’ listener.
Caused by: java.net.SocketException: Permission denied"
WFLYCTL0186: Services which failed to start: service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start ‘default’ listener.
WFLYCTL0448: 2 additional services are down due to their dependencies being missing or failed
Lastly, in case this help, this standalone.xml also includes the following:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
Please help to switch the application from IP Address, port 8080 to show in the domain URL. Perhaps I need to forward or point domain to the JBOSS home directory. Not sure or how. Any help would be greatly appreciated.
2
Answers
Using Apache as a Reverse Proxy to Wildfly through mod_proxy with CentOS.
Verify the config file (httpd.conf) Apache uses
httpd - V | grep SERVER_CONFIG_FILE
Verify the modules are enabled, either in
httpd.conf
or in modulesincludes
filesLoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so
Since the
httpd.conf
file warned against updates in file due to new Apache upgrades or regeneration of config file, to instead use the configinclude
files. In this case theincludes/post_virtualhost_global.conf
(notpre_virtualhost_global.conf
).Add the following to
includes/post_virtualhost_global.conf
ProxyPreserveHost On Proxypass / http://localhost:8080/ ProxypassReverse / http://localhost:8080/
Restart Apache service
service httpd stop
service httpd start
You’re getting an "Address already in use error" because Apache httpd is already bound to port 80. Therefore, you can’t bind your WildFly Java app to port 80 and your Java app will not start because of this. You’ll need to configure/integrate your Apache Web Server with WildFly. Something like Apache serves static content while WildFly is its application server. You’ll have something like this in your
httpd.conf
:then you’ll have something like this in your
vhosts.conf
:then something like this in
workers.properties
:then in
standalone.xml
: