<\/span><\/h2>\n\n\n\nThe Java OpenJDK version 18 is already included in the Ubuntu 22.04 repo. so we install it we need to execute the following command:<\/p>\n\n\n\n
sudo apt-get install openjdk-8-jdk -y<\/pre>\n\n\n\nOnce installed, execute the following command to check the installed Java version:<\/p>\n\n\n\n
java -version<\/pre>\n\n\n\nYou will receive the following output:<\/p>\n\n\n\n
root@host:~# java -version\nopenjdk version \"1.8.0_352\"\nOpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1~22.04-b08)\nOpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)\n<\/pre>\n\n\n\n<\/span>Step 3. Install Jetty 9<\/span><\/h2>\n\n\n\nTo install Jetty 9, execute the following command:<\/p>\n\n\n\n
sudo apt-get install jetty9 -y<\/pre>\n\n\n\nOnce installed, start and enable the jetty service.<\/p>\n\n\n\n
sudo systemctl enable jetty9 && sudo systemctl start jetty9<\/pre>\n\n\n\nCheck if the service is up and running:<\/p>\n\n\n\n
sudo systemctl status jetty9<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status jetty9\n\u25cf jetty9.service - Jetty 9 Web Application Server\n Loaded: loaded (\/lib\/systemd\/system\/jetty9.service; enabled; vendor preset: enabled)\n Active: active (running) since Tue 2022-12-27 16:08:48 CST; 1min 49s ago\n Docs: https:\/\/www.eclipse.org\/jetty\/documentation\/current\/\n Main PID: 5443 (java)\n Tasks: 25 (limit: 4575)\n Memory: 78.8M\n CPU: 4.176s\n CGroup: \/system.slice\/jetty9.service\n \u2514\u25005443 \/usr\/bin\/java -Djetty.home=\/usr\/share\/jetty9 -Djetty.base=\/usr\/share\/jetty9 \n<\/pre>\n\n\n\nThe jetty service is running on port 8080<\/b>. To check this, execute the following command:<\/p>\n\n\n\nnetstat -tunlp | grep 8080<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# netstat -tunlp | grep 8080\ntcp6 0 0 :::8080<\/b> :::* LISTEN 5443\/java<\/b>\n<\/pre>\n\n\n\n<\/span>Step 4. Install Apache Web Server<\/span><\/h2>\n\n\n\nTo install Apache, execute the following command:<\/p>\n\n\n\n
sudo apt-get install apache2 -y<\/pre>\n\n\n\nOnce installed, start and enable the service.<\/p>\n\n\n\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\n\n\n\nCheck if the service is up and running:<\/p>\n\n\n\n
sudo systemctl status apache2<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status apache2\n\u25cf apache2.service - The Apache HTTP Server\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\n Active: active (running) since Tue 2022-12-27 09:38:49 CST; 6h ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Main PID: 744 (apache2)\n Tasks: 55 (limit: 4575)\n Memory: 10.2M\n CPU: 1.542s\n CGroup: \/system.slice\/apache2.service\n \u251c\u2500744 \/usr\/sbin\/apache2 -k start\n \u251c\u2500787 \/usr\/sbin\/apache2 -k start\n \u2514\u2500788 \/usr\/sbin\/apache2 -k start\n\nDec 27 09:38:49 host.test.tk systemd[1]: Starting The Apache HTTP Server...\nDec 27 09:38:49 host.test.tk systemd[1]: Started The Apache HTTP Server.\n<\/pre>\n\n\n\n<\/span>Step 5. Configure Jetty with Apache as a Reverse Proxy<\/span><\/h2>\n\n\n\nGo into the Apache directory and create a configuration file for the Jetty.<\/p>\n\n\n\n
cd \/etc\/apache2\/sites-available\/\n\ntouch jetty.conf\n<\/pre>\n\n\n\nOpen the file, paste the following lines of code, save the file and close it.<\/p>\n\n\n\n
<VirtualHost *:80>\nServerName yourdomain.com<\/b>\nDocumentRoot \/var\/www\/html\/\n\n<Directory \/var\/www\/html>\nAllowOverride All\n<\/Directory>\n\nProxyRequests off\nProxyPass \/ http:\/\/127.0.0.1:8080\/<\/b>\nProxyPassReverse \/ http:\/\/127.0.0.1:8080\/<\/b>\n\nErrorLog ${APACHE_LOG_DIR}\/error.log\nCustomLog ${APACHE_LOG_DIR}\/access.log combined\n\n<\/VirtualHost>\n\n<\/pre>\n\n\n\n Enable the Apache configuration for Jetty and rewrite the module.<\/p>\n\n\n\n
a2dissite 000-default.conf\n\na2enmod proxy\n\na2enmod proxy_http\n\nsudo a2enmod rewrite\n\nsudo a2ensite jetty.conf\n<\/pre>\n\n\n\nCheck the syntax:<\/p>\n\n\n\n
apachectl -t<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@vps:~# apachectl -t\nSyntax OK\n<\/pre>\n\n\n\nIf the syntax is OK, restartd the Apache service.<\/p>\n\n\n\n
systemctl restart apache2\n<\/pre>\n\n\n\nOnce the Apache service is restarted, you can access Jetyy via your domain at http:\/\/yourdomain.com<\/b><\/p>\n\n\n\n<\/span>Step 6. Install Free Let’s Encrypt SSL certificate<\/span><\/h2>\n\n\n\nTo install the Free Let’s Encrypt SSL certificate first install the Certbot:<\/p>\n\n\n\n
sudo apt-get install certbot python3-certbot-apache -y<\/pre>\n\n\n\nOnce installed, generate the certificate with the following command:<\/p>\n\n\n\n
certbot --apache -d yourdomain.com<\/pre>\n\n\n\nIn the next steps, you need to add your email, confirm the license agreements, not share your email address and etc.<\/p>\n\n\n\n
root@host:\/etc\/apache2\/sites-available# certbot --apache -d yourdomain.com<\/b>\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\nEnter email address (used for urgent renewal and security notices)\n (Enter 'c' to cancel): admin@yourdomain.com<\/b>\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\nPlease read the Terms of Service at\nhttps:\/\/letsencrypt.org\/documents\/LE-SA-v1.3-September-21-2022.pdf. You must\nagree in order to register with the ACME server. Do you agree?\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n(Y)es\/(N)o: Y<\/b>\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\nWould you be willing, once your first certificate is successfully issued, to\nshare your email address with the Electronic Frontier Foundation, a founding\npartner of the Let's Encrypt project and the non-profit organization that\ndevelops Certbot? We'd like to send you email about our work encrypting the web,\nEFF news, campaigns, and ways to support digital freedom.\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n(Y)es\/(N)o: N<\/b>\nAccount registered.\nRequesting a certificate for yourdomain.com\n\nSuccessfully received certificate.\nCertificate is saved at: \/etc\/letsencrypt\/live\/yourdomain.com\/fullchain.pem<\/b>\nKey is saved at: \/etc\/letsencrypt\/live\/yourdomain.com\/privkey.pem<\/b>\nThis certificate expires on 2023-03-27.\nThese files will be updated when the certificate renews.\nCertbot has set up a scheduled task to automatically renew this certificate in the background.\n\nDeploying certificate\nSuccessfully deployed certificate for yourdomain.com to \/etc\/apache2\/sites-available\/jetty-le-ssl.conf\nCongratulations! You have successfully enabled HTTPS on https:\/\/yourdomain.com\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\nIf you like Certbot, please consider supporting our work by:\n * Donating to ISRG \/ Let's Encrypt: https:\/\/letsencrypt.org\/donate\n * Donating to EFF: https:\/\/eff.org\/donate-le\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n<\/pre>\n\n\n\n Now, you can access your Jetty service securely at https:\/\/yourdomain.com<\/b>.<\/p>\n\n\n\n
That’s it. You successfully installed and configured Jetty with Apache as a reverse proxy. If you find this setup difficult, you can always contact our technical support, and they will do the rest. We are available 24\/7, and we are ready to help you. You just need to sign up for one of our NVMe VPS plans<\/a> and submit a support ticket.<\/p>\n\n\n\nIf you liked this post about installing Jetty on Ubuntu 22.04, please share it with your friends on social networks using the buttons on the left or simply leave a reply below.<\/p>\n","protected":false},"excerpt":{"rendered":"
Jetty or Eclipse Jetty is a Java web server and Java servlet container. Jetty is free and open-source software used … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":45212,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1707],"tags":[1603,905,59],"yoast_head":"\nHow to Install Jetty on Ubuntu 22.04 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n \n \n\t \n\t \n\t \n