skip to Main Content

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


  1. Chosen as BEST ANSWER

    Using Apache as a Reverse Proxy to Wildfly through mod_proxy with CentOS.

    1. Verify the config file (httpd.conf) Apache uses

      httpd - V | grep SERVER_CONFIG_FILE

    2. Verify the modules are enabled, either in httpd.conf or in modules includes files

      LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so

    3. Since the httpd.conf file warned against updates in file due to new Apache upgrades or regeneration of config file, to instead use the config include files. In this case the includes/post_virtualhost_global.conf (not pre_virtualhost_global.conf).

    4. Add the following to includes/post_virtualhost_global.conf

      ProxyPreserveHost On Proxypass / http://localhost:8080/ ProxypassReverse / http://localhost:8080/

    5. Restart Apache service

      service httpd stop

      service httpd start


  2. 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:

    JkWorkersFile conf/workers.properties
    JkLogFile logs/mod_jk.log
    JkLogLevel info
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    JkRequestLogFormat "%w %V %T"
    LoadModule jk_module modules/mod_jk.so
    

    then you’ll have something like this in your vhosts.conf:

    <VirtualHost *:80>
        ServerName example.com
        DocumentRoot "/dir/dir"
        
        ... snipped ...
    
        JkMount /* jboss
    </VirtualHost> 
    

    then something like this in workers.properties:

    worker.list = jboss
    
    worker.jboss.type=ajp13
    worker.jboss.host=localhost
    worker.jboss.port=8009
    

    then in standalone.xml:

    <socket-binding-group ... snipped ... >
        <socket-binding name="ajp" port="${jboss.ajp.port:8009}" />
        ... snipped ...
    </socket-binding-group>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search