By jboo
I have an old website that running PHP, but now i’m developing a small website in JSP. I would like to run both from one server. something as in: website.com/php/… and website.com/jsp/… also, hoping to inclued SSL
if this is possible, what steps should i take to accomplish this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Install Tomcat on the server and run in on port 8080 for example. Make sure your JSP is working fine through Tomcat. Then use Apache’s mod_proxy to forward requests that are going to /jsp/ to Tomcat. Here’s a link with some more info:
https://rimuhosting.com/mod_jk2_and_mod_proxy_ajp.jsp
Cheers
You can do that by using Tomcat and Apache.
Install Apache and Tomcat:
sudo apt update
sudo apt install apache2
sudo apt install tomcat9
sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo systemctl restart apache2
sudo apt install libapache2-mod-jk
Configure mod_jk in /etc/apache2/workers.properties:
worker.list=tomcat
worker.tomcat.type=ajp13
worker.tomcat.host=localhost
worker.tomcat.port=8009
Configure Apache Virtual Host: Edit /etc/apache2/sites-available/000-default.conf and add:
<VirtualHost *:443>
ServerName website.com
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem
Alias /php /var/www/html/php
<Directory /var/www/html/php>
AllowOverride All
</Directory>
JkMount /jsp/* tomcat
</VirtualHost>
Restart Apache and Tomcat
sudo systemctl restart apache2
sudo systemctl restart tomcat9
This will serve PHP from /php/ and JSP from /jsp/ under the same domain.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.