Code Monkey home page Code Monkey logo

wildfly-servlet-example's Introduction

WildFly-Servlet-Example

Please perform the next steps to setup a full pack of applications:

Update the system

sudo apt update && sudo apt upgrade -y

Install OpenJDK 11 JDK

sudo apt install openjdk-11-jdk -y

Install Apache HTTP Server

sudo apt install apache2 -y

Download and unpack WildFly distribution

wget https://github.com/wildfly/wildfly/releases/download/30.0.0.Final/wildfly-30.0.0.Final.tar.gz
tar xf wildfly-30.0.0.Final.tar.gz
sudo mv wildfly-30.0.0.Final /opt/wildfly

Create a new user and group for WildFly service

sudo useradd --system --no-create-home --user-group wildfly

Change the owner of /opt/wildfly directory to the wildfly user and group

sudo chown -R wildfly:wildfly /opt/wildfly

Create a configuration file for the WildFly service

sudo bash -c 'cat > /etc/systemd/system/wildfly.service << EOF
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target

[Service]
User=wildfly
Group=wildfly
ExecStart=/opt/wildfly/bin/standalone.sh -b=0.0.0.0
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF'

Reload the systemd system configuration

sudo systemctl daemon-reload

Start the WildFly service

sudo systemctl start wildfly

Install your test web application

sudo mv your-app.war /opt/wildfly/standalone/deployments/

Enable the WildFly service to start on boot

sudo systemctl enable wildfly

Create a directory for private key and certificate

sudo mkdir /etc/apache2/ssl

Generate self-signed SSL certificate and private key

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Configure Apache to use SSL

sudo bash -c 'cat > /etc/apache2/sites-available/000-default.conf << EOF
<VirtualHost *:80>
   ServerName localhost
   Redirect / https://localhost/
</VirtualHost>

<VirtualHost *:443>
   SSLEngine on
   SSLCertificateFile /etc/apache2/ssl/apache.crt
   SSLCertificateKeyFile /etc/apache2/ssl/apache.key

   ProxyRequests Off
   ProxyPreserveHost On
   ProxyPass / http://localhost:8080/
   ProxyPassReverse / http://localhost:8080/
</VirtualHost>
EOF'

Enable the SSL and proxy modules

sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_http

Restart Apache to implement changes

sudo systemctl restart apache2

Configure WildFly to use the correct IP address [optional]

sudo sed -i 's/<inet-address value="${jboss.bind.address.management:127.0.0.1}"/<inet-address value="${jboss.bind.address.management:0.0.0.0}"/g' /opt/wildfly/standalone/configuration/standalone.xml
sudo sed -i 's/<inet-address value="${jboss.bind.address:127.0.0.1}"/<inet-address value="${jboss.bind.address:0.0.0.0}"/g' /opt/wildfly/standalone/configuration/standalone.xml

Restart the WildFly service [optional]

sudo systemctl restart wildfly

wildfly-servlet-example's People

Contributors

xadmax avatar yegormaksymchuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.