Close Menu
IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
  • Home
  • News
  • Blog
  • Selfhosting
  • AI
  • Linux
  • Cyber Security
  • Gadgets
  • Gaming

Subscribe to Updates

Get the latest creative news from ioupdate about Tech trends, Gaming and Gadgets.

    What's Hot

    The AI Hype Index: AI-powered toys are coming

    June 27, 2025

    How to Schedule Incremental Backups Using rsync and cron

    June 27, 2025

    Hacker ‘IntelBroker’ charged in US for global data theft breaches

    June 27, 2025
    Facebook X (Twitter) Instagram
    Facebook Mastodon Bluesky Reddit
    IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
    • Home
    • News
    • Blog
    • Selfhosting
    • AI
    • Linux
    • Cyber Security
    • Gadgets
    • Gaming
    IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
    Home»Selfhosting»How to Install GlassFish Application Server with Nginx Reverse Proxy on Debian 12
    Selfhosting

    How to Install GlassFish Application Server with Nginx Reverse Proxy on Debian 12

    AndyBy AndyMay 12, 2025No Comments4 Mins Read
    How to Install GlassFish Application Server with Nginx Reverse Proxy on Debian 12


    Summary: This guide provides a comprehensive step-by-step process for self-hosting the GlassFish Application Server on Debian 12. You’ll learn how to install Java OpenJDK, configure your system, and integrate Nginx as a reverse proxy. Perfect for tech-savvy readers interested in self-hosting Java applications, this tutorial covers everything from installation to security measures.

    Introduction to GlassFish for Self-Hosting

    GlassFish is a renowned open-source implementation of the Java EE Platform developed by Eclipse. As the world’s first Java EE implementation, it serves as a lightweight and efficient application server, allowing the deployment of multiple Java-based applications. Supporting various Java technologies like Enterprise JavaBeans, JPA, and JavaServer Faces, GlassFish is an excellent choice for developers seeking to self-host robust Java applications.

    Prerequisites for Installing GlassFish

    Before diving into the installation process, ensure you have:

    • A Debian 12 server with a minimum of 4GB of RAM.
    • A non-root user with sudo privileges.

    Installing Java OpenJDK

    To use GlassFish effectively, you must install Java first. The Debian repository offers Java OpenJDK 17, compatible with the latest version of GlassFish.

    Start by updating your Debian repository:

    sudo apt update

    Once updated, install the default JDK package:

    sudo apt install default-jdk

    Verify your Java installation:

    java -version

    Setting Up Your Debian System

    After installing Java OpenJDK, prepare your system by installing additional packages like wget and unzip. You’ll also create a glassfish system user and configure the JAVA_HOME environment variable.

    sudo apt install unzip wget -y
    sudo useradd -M -d /opt/glassfish -U -s /bin/false glassfish

    Create the bash script for JAVA_HOME:

    sudo nano /etc/profile.d/java.sh

    Add the following lines:

    export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
    export PATH=$PATH:$JAVA_HOME/bin

    Load the new environment variables:

    source /etc/profile.d/java.sh

    Downloading GlassFish

    With Java installed, download GlassFish from the official site. Navigate to the /tmp directory and use wget to download the latest binary package:

    cd /tmp
    wget https://download.eclipse.org/ee4j/glassfish/glassfish-7.0.10.zip

    Extract the package:

    unzip glassfish-7.0.10.zip -d /opt

    Rename the extracted directory and adjust ownership:

    mv /opt/glassfish7 /opt/glassfish
    sudo chown -R glassfish:glassfish /opt/glassfish

    Running GlassFish as a Systemd Service

    Create a systemd service file to manage GlassFish:

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

    Insert the following config:

    [Unit]
    Description=GlassFish Server v7
    After=syslog.target network.target [Service]
    User=glassfish
    ExecStart=/opt/glassfish/bin/asadmin start-domain
    ExecReload=/opt/glassfish/bin/asadmin restart-domain
    ExecStop=/opt/glassfish/bin/asadmin stop-domain
    Type=forking [Install]
    WantedBy=multi-user.target

    Reload systemd and start GlassFish:

    sudo systemctl daemon-reload
    sudo systemctl start glassfish
    sudo systemctl enable glassfish

    Securing GlassFish Administration

    Now that GlassFish is running, secure the admin console by changing the default password:

    sudo -u glassfish /opt/glassfish/bin/asadmin --port 4848 change-admin-password

    Enable secure admin to ensure SSL communications:

    sudo -u glassfish /opt/glassfish/bin/asadmin --port 4848 enable-secure-admin

    Restart GlassFish to apply changes:

    sudo systemctl restart glassfish

    Installing Nginx as a Reverse Proxy

    To enhance your setup, install Nginx for use as a reverse proxy:

    sudo apt install nginx

    Create a server block configuration for GlassFish:

    sudo nano /etc/nginx/sites-available/glassfish

    Add the server configuration:

    server {
        listen 80;
        server_name glassfish.howtoforge.local;
    
        location / {
            proxy_pass http://127.0.0.1:8080;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

    Link and restart Nginx:

    sudo ln -s /etc/nginx/sites-available/glassfish /etc/nginx/sites-enabled/
    sudo systemctl restart nginx

    Accessing Your GlassFish Installation

    To access your GlassFish installation, modify your local /etc/hosts file to point to the GlassFish server. Use the following entry:

    192.168.5.15 glassfish.howtoforge.local

    Using your browser, visit http://glassfish.howtoforge.local for the default page. For administration, go to https://glassfish.howtoforge.local:4848.

    Frequently Asked Questions

    What is GlassFish?

    GlassFish is an open-source application server for Java EE, designed for deploying various Java-based applications efficiently.

    Why use Nginx as a reverse proxy for GlassFish?

    Nginx provides better security, load balancing, and can handle SSL termination, making it a great addition to your GlassFish setup.

    Conclusion

    In this guide, you successfully installed the GlassFish Application Server on Debian 12, set up Java OpenJDK, and configured Nginx as a reverse proxy. You also secured your GlassFish installation and are now ready to deploy your Java applications. Enjoy your self-hosting journey!



    Read the original article

    0 Like this
    application Debian GlassFish install NGINX proxy Reverse Server
    Share. Facebook LinkedIn Email Bluesky Reddit WhatsApp Threads Copy Link Twitter
    Previous ArticleCatching a phish with many faces
    Next Article Samsung Galaxy Watch 8 Classic: Features, Leaks, and More

    Related Posts

    Selfhosting

    Self-Host Weekly (20 June 2025)

    June 27, 2025
    Selfhosting

    Docker Rollout: Zero-Downtime Deployments for Docker Compose Made Simple

    June 25, 2025
    Selfhosting

    2025.6: Getting picky about Bluetooth

    June 25, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    AI Developers Look Beyond Chain-of-Thought Prompting

    May 9, 202515 Views

    6 Reasons Not to Use US Internet Services Under Trump Anymore – An EU Perspective

    April 21, 202512 Views

    Andy’s Tech

    April 19, 20259 Views
    Stay In Touch
    • Facebook
    • Mastodon
    • Bluesky
    • Reddit

    Subscribe to Updates

    Get the latest creative news from ioupdate about Tech trends, Gaming and Gadgets.

      About Us

      Welcome to IOupdate — your trusted source for the latest in IT news and self-hosting insights. At IOupdate, we are a dedicated team of technology enthusiasts committed to delivering timely and relevant information in the ever-evolving world of information technology. Our passion lies in exploring the realms of self-hosting, open-source solutions, and the broader IT landscape.

      Most Popular

      AI Developers Look Beyond Chain-of-Thought Prompting

      May 9, 202515 Views

      6 Reasons Not to Use US Internet Services Under Trump Anymore – An EU Perspective

      April 21, 202512 Views

      Subscribe to Updates

        Facebook Mastodon Bluesky Reddit
        • About Us
        • Contact Us
        • Disclaimer
        • Privacy Policy
        • Terms and Conditions
        © 2025 ioupdate. All Right Reserved.

        Type above and press Enter to search. Press Esc to cancel.