How to install WildFly on Ubuntu 16.04

How to install WildFly on Ubuntu 16.04

In this tutorial we are going to provide you with step by step instructions on how to install WildFly with Nginx as a reverse proxy on an Ubuntu 16.04 VPS.
WildFly is a flexible and lightweight open source application server authored by JBoss, now developed by Red Hat.
At the moment of writing this article, WildFly 10 is the latest release in a series of JBoss open-source application server offerings.

1. Update your system

Let’s start with the installation. Make sure your server OS packages are fully up-to-date:

apt-get update 
apt-get upgrade

2. Remove Apache server

Stop and remove Apache, then install nginx using the following commands:

service apache2 stop
apt-get remove apache2
apt-get autoremove
apt-get install nginx

3. Configure Nginx

Edit the default nginx configuration file:

vi /etc/nginx/sites-enabled/default

Delete the following line:

listen [::]:80 default_server;

4. Enable nginx service

Enable nginx service to start on boot and start it:

systemctl enable nginx
systemctl start nginx.service

5. Install Java

In order to run WildFly, Java has to be installed on the server so run the following command to install the Java Development Kit package (JDK):

apt-get install default-jdk

To find out what version of Java has been installed, run:

java -version

The output should be something like this:

openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

6. Create WildFly User

groupadd -r wildfly
useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

7. Download WildFly

Download the latest version of WildFly available at ‘’ to a directory on the server and extract it using the following commands:

cd /opt
tar -xvzf wildfly-10.0.0.Final.tar.gz
mv wildfly-10.0.0.Final wildfly

8. Configure WildFly

Create a wildfly configuration file:

vi /etc/default/wildfly

Add the following lines to it:


so it will start WildFly 10 using the default web profile configuration in ‘standalone’ mode.
Create a WildFly startup script, named ‘’:

vi /opt/wildfly/bin/

if [ "x$WILDFLY_HOME" = "x" ]; then

if [ "x$1" = "xdomain" ]; then
    echo 'Starting Wildfly in domain mode.'
    $WILDFLY_HOME/bin/ -c $2 -b $3
    echo 'Starting Wildfly in standalone mode.'
    $WILDFLY_HOME/bin/ -c $2 -b $3

Make the startup script executable:

chmod 755 /opt/wildfly/bin/

WildFly can be started using the script we created in the /opt/wildfly/bin directory or even better, we will create a systemd init file for that purpose:

vi /etc/systemd/system/wildfly.service
Description=The WildFly Application Server



Set the proper ownership of files and directories located to the /opt/wildfly directory:

chown wildfly:wildfly -R /opt/wildfly/

Start the WildFly service and enable WildFly to start on boot:

systemctl daemon-reload
systemctl start wildfly
systemctl enable wildfly

9. Create a new nginx block

Create a new nginx block so you can access the WildFly management interface using nginx as a reverse proxy:

vi /etc/nginx/sites-available/wildfly

Add the following lines:

upstream wildfly {

server {
    listen      80;

    access_log  /var/log/nginx/wildfly.access.log;
    error_log   /var/log/nginx/wildfly.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

location / {
        proxy_pass  http://wildfly;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;


Do not forget to replace ‘’ with your actual domain name.

ln -s /etc/nginx/sites-available/wildfly /etc/nginx/sites-enabled/

Restart nginx for the changes to take effect:

systemctl restart nginx.service

10. Add new user

In order to access the WildFly management console, you need to add a new user. Execute the script within the bin directory of the WildFly installation and enter the requested information:


That is it. The WildFly installation is now complete.

To access the WildFly management console, open using the newly created user login credentials.
wildfly management console

Of course you don’t have to install WildFly on Ubuntu 16.04, if you use one of our VPS Hosting services, in which case you can simply ask our expert Linux admins to install WildFly on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install WildFly on Ubuntu 16.04 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install GitBucket on Ubuntu 16.04
How to install and use WP-CLI on a Linux VPS
How to install Suhosin on a Linux VPS
  • Mateusz


    Author Reply

    Thanks for this tutorial. Installation goes good. The wildfly is started, but after clicking Administration Console i have message – the site can’t be reach – refused to connect. So it is probably some problem with my vps. Any idea?

    • admin


      Author Reply

      What port is the admin console listening on?

      Could you please provide us with the complete error message?

  • Hop


    Author Reply

    Great manual, works very well, thanks!

  • Jeff


    Author Reply

    I see the same issue trying to reach the admin console. The port 80 brings up the Wildfly home – navigating to the admin console redirects to port 9990 /console http: // – unable to connect

  • Cristian


    Author Reply

    what´s location / ? In the vi /etc/nginx/sites-available/wildfly.

    • admin


      Author Reply

      The location block “/” will match all requests starting with “/”, such as, yourdomain/other_ulr/ ..etc.

  • Andrés Carranza

    Hi, very interesting, very useful