Let's run Servlet on Amazon Corretto now

As the title suggests, this entry says that we should use Amazon Corretto instead of Oracle Java, which is difficult to select, to run Servlet. Well, I wonder how many similar articles already have! !! But I will write without worrying about that.

Prepare apps

The versions of the apps prepared this time are as follows. Even if there is no detailed version, I think it will work.

First install Apache

  1. First, run VC_redist.x64.exe. This is a C ++ redistributable package, isn't it? It looks like you'll need it to run Apache's Windows binaries.
  2. Extract httpd-2.4.41-win64-VC15.zip. By the way, put the folder name around httpd, and in my case, place it in the root of C drive. Up to the core file is C: \ httpd \ Apache24 \ bin \ httpd.exe.
  3. Open C: \ httpd \ Apache24 \ conf \ httpd.conf and set the document root. Then, at the command prompt, move to C: \ httpd \ Apache24 \ bin \ and execute [httpd -k install]. If there is no error, it will be registered as a service and will be executed.
  4. Access localhost with a browser and it is OK if [It works!] Is displayed.

Next, install Amazon Corretto

It is a Java package managed and distributed by Amazon that competes with Oracle Java. With Ver11, long-term support will continue until the middle of 2024, and you can use it with the same license as OpenJava (isn't it?).

  1. Run the installer. Maybe it's better to run it as an administrator. There is nothing particularly difficult, and I think it will end if you click [Next].
  2. And of course the installer will do the environment variables such as JAVA_HOME.

And finally install tomcat

  1. Install Tomcat at the very end. You can do this as an administrator and just click [Next].
  2. Perhaps the only mean thing is that it's not Oracle Java, or because the Virtual Maschine selection form is empty, specify the directory where you installed Corretto.

Finally, change the settings a little

  1. First, create a file called httpd-proxy-ajp.conf in C: \ httpd \ Apache24 \ conf \ extra. You can use other file names as it only matches other files in the same directory.
  2. Once created, open the file and write the magic. The part enclosed in slashes following "Location" on the first line is the folder name following the domain name. The second line looks like a path that includes the port for that folder. In other words, Apache and Tomcat will secretly display http://www.example.com:8009/docs/ when http://www.example.com/docs/ is accessed, which is a nuance.

<Location /docs/> ProxyPass ajp://127.0.0.1:8009/docs/ </Location>

After writing the above, make this file visible from C: \ httpd \ Apache24 \ conf \ hgttpd.conf and restart Apache and Tomcat.

〆 Yes, I think I wrote it for a while, but I think it's working fine. After that, you can use php or MariaDB as you like!

Recommended Posts

Let's run Servlet on Amazon Corretto now
Let's touch on Java
Install Corretto 8 on Windows
Run STS4 on Mac
[Java] Install Amazon Corretto 8
Test run on rails
Run PostgreSQL on Java
Use Corretto 11 on Heroku
Run Processing on Ant
Run tiscamera on Ubuntu 18.04
Run phpunit on Docker
Until you run Quarkus and run docker image on Amazon ECS
Run R from a tomcat-powered Java process on Amazon Linux