[Java] Apache + Tomcat + Pebble built locally on Mac

2 minute read

About

*This article is exclusively for the issue of security outlook. Please note.

It is a memorandum because I set up Apache for the university problem, made it SSL, and started Pebble from Tomcat that was linked with Apache. I omit the setting part of Apache and local SSL. By the way, I wrote about SSL in the following article. https://qiita.com/Raluer/items/02b848437844ba3cbb6c

Edit #httpd.conf Comment out the following LoadModule

/usr/local/etc/httpd/httpd.conf


LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so

Add the following sentence at the end of the file Read the settings for AJP communication (which will be created from now) described in the external config file.

/usr/local/etc/httpd.conf


Include /usr/local/etc/httpd/extra/httpd-proxy.conf

Edit #httpd-proxy.conf

In the terminal /usr/local/etc/httpd/extra/

/usr/local/etc/extra


$ sudo vim httpd-proxy.conf

Then vim starts up and a new file is created, so copy and paste the following code.

/usr/local/etc/extra

/httpd-proxy.conf
<Location /pebble>
  ProxyPass ajp://localhost:8009/pebble
  Order allow,deny
  Allow from all
</Location>

With this, the Apache setting is all right I will add Tomcat from here.

Tomcat install

From Official Site, select the version you like and press “Download”. Click “tar.gz” from “Core” on the jumped page to download. It might be easier later if you download it to the root directory (at ~/). It’s fine anywhere.

Unzip the downloaded tar.gz file from Finder and look inside. There is a folder called “conf” so enter it and open server.xml with your favorite text editor.

The following code around line 74,

conf/server.xml


<Connector executor="tomcatThreadPool"
          port="8080" protocol="HTTP/1.1"
          connectionTimeout="20000"
          redirectPort="8443" />

Since we are not using HTTP communication this time, comment out.

conf/server.xml


<!--
<Connector executor="tomcatThreadPool"
          port="8080" protocol="HTTP/1.1"
          connectionTimeout="20000"
          redirectPort="8443" />
- ->

Next, rewrite the address of the setting for AJP communication used this time, around line 117, to 127.0.0.1, add secretRequired, and set the parameter to false (only when local!).

conf/server.xml


<Connector protocol="AJP/1.3"
           address="127.0.0.1"
           port="8009"
           redirectPort="8443"
           secretRequired="false" />

By the way, I was really into it because I didn’t set secretRequired.

Introducing #Pebble If you come this far, it’s the last spurt. First, download Pebble from this site. The download location is a little difficult to find, but you can download it by clicking Pebble 2.6.4 in the upper right. image.png

Unzip the downloaded file, copy pebble-2.6.4.war in the unzipped folder without unzipping, move to the Tomcat directory, and paste it directly under webapps .. The original folder is not needed. Use only the war file that is inside. Since we will access the war file later, let’s rename the pebble.war.

Start Tomcat and Apache server

If you come here, you almost finish. Open a terminal and go into the Tomcat bin. To start the Tomcat server, in the bin on the terminal

tomcat/bin


$ ./startup.sh

Just type the command. By the way, when you stop

tomcat/bin


$ ./shutdown.sh

Just run it in the same place. After confirming that it starts up, just

terminal


$ apachectl start

To start the apache server.

goal!

Both the Tomcat server and the apache server are now running, so if you type localhost/pebble in the URL of your browser, you should see the Pebble Welcome page after a short load.

image.png

Postscript

I am very addicted to it, so please refer to it and run smoothly.

Checkpoint if you get hooked

Is port 8009 full? If it’s filled, you can use another port (8019, etc.). Don’t forget to change both server.xml and httpd-proxy.conf!

Reference site

https://ameblo.jp/g-pinchan-new/entry-11573378743.html https://qiita.com/brighton0725/items/0e116db637a8fea1d907