WildFly is a powerful, open-source Java application server used for deploying Java-based applications. Nginx can act as a reverse proxy to route traffic to WildFly, improving performance and security. In this guide, we will show you how to install WildFly and set up Nginx as a reverse proxy on Rocky Linux 8. Whether you're deploying this on a local server or using a Windows VPS UK, the steps provided will help you get started.

Step 1: Update Your System

Before starting, ensure your Rocky Linux system is up to date by running the following commands:

sudo dnf update -y

This ensures your system is ready for the WildFly and Nginx installation, whether you are deploying it locally or on a VPS Windows Servers platform.

Step 2: Install Java

WildFly requires Java to run. Install OpenJDK 11, which is supported by WildFly, using this command:

sudo dnf install java-11-openjdk-devel -y

Verify the installation:

java -version

This command should return the installed version of Java.

Step 3: Download and Install WildFly

Download the latest version of WildFly using the following command:


cd /opt
sudo wget https://github.com/wildfly/wildfly/releases/download/26.1.1.Final/wildfly-26.1.1.Final.tar.gz
            

Extract the downloaded file:

sudo tar -xvzf wildfly-26.1.1.Final.tar.gz

Move the extracted folder to a more suitable location:

sudo mv wildfly-26.1.1.Final /opt/wildfly

Step 4: Set Up WildFly as a Service

Create a new service file for WildFly to run as a systemd service:

sudo nano /etc/systemd/system/wildfly.service

Add the following content to the file:


[Unit]
Description=WildFly Application Server
After=network.target

[Service]
User=root
ExecStart=/opt/wildfly/bin/standalone.sh -b=0.0.0.0
StandardOutput=null

[Install]
WantedBy=multi-user.target
            

Save and exit the file.

Reload systemd to apply the changes:

sudo systemctl daemon-reload

Start and enable the WildFly service:

sudo systemctl start wildfly
sudo systemctl enable wildfly

Step 5: Install and Configure Nginx

Install Nginx using the following command:

sudo dnf install nginx -y

Create a new Nginx configuration file for the reverse proxy:

sudo nano /etc/nginx/conf.d/wildfly.conf

Add the following content to the file:


server {
    listen 80;
    server_name your_domain_or_IP;

    location / {
        proxy_pass http://localhost:8080;
        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 $scheme;
    }
}
            

Replace your_domain_or_IP with your domain name or server IP address.

Test the Nginx configuration:

sudo nginx -t

If the configuration test passes, start and enable Nginx:

sudo systemctl start nginx
sudo systemctl enable nginx

Step 6: Allow Firewall Rules

Update your firewall to allow HTTP and WildFly connections:


sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
            

Step 7: Access the WildFly Application

You can now access your WildFly application through Nginx by navigating to:

http://your_domain_or_IP

This will serve your WildFly application through Nginx as a reverse proxy.

You have successfully installed WildFly and set up Nginx as a reverse proxy on Rocky Linux 8. For reliable and scalable hosting solutions, consider using Windows VPS UK. They offer a variety of hosting options, including windows virtual private servers, vps windows hosting, and windows virtual dedicated server hosting. Whether you're looking for windows vps italy or uk vps windows, their services provide the performance and flexibility you need for hosting Java-based applications like WildFly.

¿Fue útil la respuesta? 0 Los Usuarios han Encontrado Esto Útil (0 Votos)