Run NGINX server as redirector for Applicare controller (Build Nginx from Source on Linux)
Step 1: Follow the instruction to Install Applicare
Note: Enter the server IP and server port in the Applicare.props and ApplicareController.props file with the nginx running IP and port.
Step 2: Download nginx
Step 3: Download the zlib and pcre library file
Step 4: Extract the Nginx, zlib, Pcre zip file.
Step 5: Follow the steps below to install and run Nginx as Services.
1. Go to Nginx extracted directory.
2. Execute Below command.
./configure --with-pcre=<pcre_ectracted_directory> --with-zlib=<zlib_ectracted_directory>
make
make install
3. To view the version of nginx, do the following.
cd /usr/local/nginx/sbin ./nginx -v
Step 5: Below steps for starting services on Nginx.
1. Go to below directory.
/lib/systemd/system
2. we can create a nginx.service file.
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3. You can enable Nginx on startup with the following command.
systemctl enable nginx
Step 6: Go to the /usr/local/nginx/conf folder. And edit the nginx.conf file.
Step 7: Enter the IP of the machine running nginx instead of localhost where the server name is.
Step 8: Add the below line before server line
upstream tomcat {
ip_hash;
server <Controller_IP>:<Contrller_Port>;
}
Step 9: Add the below line in end of location line.
proxy_pass http://tomcat;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Please sign in to leave a comment.
Comments
0 comments