Before you start
WildFly is a full Jakarta EE server with EJB, CDI, JMS and JPA built in. It is heavier than Tomcat: expect 500 to 700 MB used before your application loads, so use a server with 4 GB of RAM or more. Recent releases need Java 17 or newer.
1. Install Java and create a user
sudo apt update
sudo apt install -y openjdk-21-jdk-headless curl
sudo useradd --system --home-dir /opt/wildfly --shell /usr/sbin/nologin wildfly
2. Download and unpack WildFly
Find the latest version on wildfly.org/downloads and set it below.
WILDFLY_VERSION=XX.0.0.Final # replace with the current release
cd /tmp
curl -fSLO https://github.com/wildfly/wildfly/releases/download/${WILDFLY_VERSION}/wildfly-${WILDFLY_VERSION}.tar.gz
curl -fsSL https://downloads.jboss.org/wildfly/${WILDFLY_VERSION}/wildfly-${WILDFLY_VERSION}.tar.gz.sha1
sha1sum wildfly-${WILDFLY_VERSION}.tar.gz # the two values must match
sudo tar -xzf wildfly-${WILDFLY_VERSION}.tar.gz -C /opt
sudo ln -sfn /opt/wildfly-${WILDFLY_VERSION} /opt/wildfly
sudo chown -R wildfly:wildfly /opt/wildfly-${WILDFLY_VERSION}
3. Configure it for a reverse proxy
Two settings matter behind Nginx: trust the forwarded headers, and remove the default welcome page so your application can own the root path.
cat > /tmp/wildfly-setup.cli <<'EOF'
embed-server --std-out=echo
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)
/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
stop-embedded-server
EOF
sudo chown wildfly:wildfly /tmp/wildfly-setup.cli
cd /tmp && sudo -u wildfly env JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 \
/opt/wildfly/bin/jboss-cli.sh --file=/tmp/wildfly-setup.cli
4. Create the systemd service
Bind both the application and management interfaces to localhost. Never expose the management port (9990) to the internet.
sudo tee /etc/systemd/system/wildfly.service >/dev/null <<'EOF'
[Unit]
Description=WildFly
After=network.target
[Service]
User=wildfly
Group=wildfly
Environment=JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
Environment="JAVA_OPTS=-Xms512m -Xmx2g -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m -XX:+ExitOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true"
ExecStart=/opt/wildfly/bin/standalone.sh -b 127.0.0.1 -bmanagement 127.0.0.1
SuccessExitStatus=143
Restart=on-failure
RestartSec=5
LimitNOFILE=102642
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now wildfly
sudo journalctl -u wildfly -n 30 --no-pager
Wait for a line saying WildFly started in a few seconds. The -Xmx2g above suits an 8 GB server with a database. For a 4 GB server use about 1.5 GB.
5. Deploy a WAR
Copy the file as ROOT.war so it is served at /:
sudo install -o wildfly -g wildfly -m 0644 myapp.war /opt/wildfly/standalone/deployments/ROOT.war
ls /opt/wildfly/standalone/deployments/
WildFly creates ROOT.war.deployed on success and ROOT.war.failed with the reason in the file if the deployment broke. Then add Nginx and SSL as in this guide, proxying to 127.0.0.1:8080.
Add an admin user (optional)
The management console is only reachable on localhost. Open it through an SSH tunnel when you need it:
sudo -u wildfly /opt/wildfly/bin/add-user.sh
ssh -L 9990:127.0.0.1:9990 user@your-server # then browse to http://localhost:9990
Want it running without the work? See WildFly hosting: a Business server (8 GB) from €15.30 per month is the size we recommend.
Last updated October 29, 2026.