Thursday, February 10, 2022

How To install GlassFish Application Server with Nginx on Rocky Linux 8.5

 in This Tutorial you will Learn " How To install GlassFish Application Server with Nginx on Rocky Linux 8.5"

GlassFish is an open-source and Java-supported application server through which users can run Java-based applications. It supports the latest Java platforms such as Enterprise JavaBeans, JavaServer Faces, JPA, JavaServer Pages, JMS, RMI and servlets, etc. Glassfish allows developers to build enterprise applications that are scalable and portable and can integrate with legacy technologies.

NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more
Homepage - https://javaee.github.io/glassfish/
__________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
__________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf install java-11-openjdk-devel nginx -y
java -version ; useradd -s /sbin/nologin glassfish
wget http://download.oracle.com/glassfish/5.0/release/glassfish-5.0.zip
unzip -d /opt/ glassfish-5.0.zip ; chown -R glassfish:glassfish /opt/glassfish5/
nano /usr/lib/systemd/system/glassfish.service
[Unit]
Description = GlassFish Server v5.0
After = syslog.target network.target
[Service]
User = glassfish
ExecStart = /usr/bin/java -jar /opt/glassfish5/glassfish/lib/client/appserver-cli.jar start-domain
ExecStop = /usr/bin/java -jar /opt/glassfish5/glassfish/lib/client/appserver-cli.jar stop-domain
ExecReload = /usr/bin/java -jar /opt/glassfish5/glassfish/lib/client/appserver-cli.jar restart-domain
Type = forking
[Install]
WantedBy = multi-user.target
systemctl start glassfish.service ; systemctl enable glassfish.service ; systemctl status glassfish.service

nano /etc/nginx/conf.d/yourdomain.conf
server {
    listen 80;
    server_name www.example.com;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         http://127.0.0.1:8080;
    }
}
systemctl restart nginx ; systemctl enable nginx ; systemctl status nginx
firewall-cmd --add-port={4848,8080,8181}/tcp --permanent ; firewall-cmd --reload
firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload
echo "192.168.1.60 www.example.com"  >> /etc/hosts
www.example.com
http://127.0.0.1:8080 Or http://127.0.0.1:4848
__________________________________________________________________________________________

No comments:

Post a Comment