Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Tuesday, March 24, 2020

Install Maven bu Using the TAR binary file

wget http://www.eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar xzf apache-maven-3.3.9-bin.tar.gz
mkdir /usr/local/maven
mv apache-maven-3.3.9/ /usr/local/maven/
alternatives --install /usr/bin/mvn mvn /usr/local/maven/apache-maven-3.3.9/bin/mvn 1
alternatives --config mvn

Sunday, March 15, 2020

Connect to Tomcat Manager and Host Manager from a remote machine


For security reasons, Tomcat Manager and Tomcat Host Manager cannot be accessed over a public IP address. Both applications only work from localhost by default but you can allow remote connections by changing their configuration.

Connect to Tomcat Host Manager from a different remote machine
In order to allow remote connections to the Tomcat Host Manager, follow the instructions below:
  • Create the file$CATALINA_HOME/conf/Catalina/localhost/host-manager.xml with the following content:
    <Context privileged="true" antiResourceLocking="false"
            docBase="${catalina.home}/webapps/host-manager">
        <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
    </Context>
  • Start Tomcat:
    $CATALINA_HOME/bin/startup.sh

Connect to Tomcat Manager from a different remote machine
 
In order to allow remote connections to the Tomcat Manager, follow the instructions below:
  • Create the file $CATALINA_HOME/conf/Catalina/localhost/manager.xml with the following content:
    <Context privileged="true" antiResourceLocking="false"
            docBase="${catalina.home}/webapps/manager">
        <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
    </Context>
  • Start Tomcat:
    $CATALINA_HOME/bin/startup.sh

Sunday, July 28, 2019

Server Error Codes


Informational
  • 100 - Continue
  • 101 - Switching Protocols
Successful
  • 200 - OK
  • 201 - Created
  • 202 - Accepted
  • 203 - Non-Authoritative Information
  • 204 - No Content
  • 205 - Reset Content
  • 206 - Partial Content
Redirection
  • 300 - Multiple Choices
  • 301 - Moved Permanently
  • 302 - Found
  • 303 - See Other
  • 304 - Not Modified
  • 305 - Use Proxy
  • 307 - Temporary Redirect
Client Error
  • 400 - Bad Request
  • 401 - Unauthorized
  • 402 - Payment Required
  • 403 - Forbidden
  • 404 - Not Found
  • 405 - Method Not Allowed
  • 406 - Not Acceptable
  • 407 - Proxy Authentication Required
  • 408 - Request Timeout
  • 409 - Conflict
  • 410 - Gone
  • 411 - Length Required
  • 412 - Precondition Failed
  • 413 - Request Entity Too Large
  • 414 - Request-URI Too Long
  • 415 - Unsupported Media Type
  • 416 - Requested Range Not Satisfiable
  • 417 - Expectation Failed
Server Error
  • 500 - Internal Server Error
  • 501 - Not Implemented
  • 502 - Bad Gateway
  • 503 - Service Unavailable
  • 504 - Gateway Timeout
  • 505 - HTTP Version Not Supported

Increase Idle timeout on Apache LoadBalancer

Increase Idle timeout on Apache Loadbalancer from 60 to 300 sec and added below parameter on Apache level
    Timeout 600
    ProxyTimeout 600

libssl.so.1.0.0: cannot open shared object file:

Issue: while starting apache will through below error

load modules/mod_ssl.so into server: libssl.so.1.0.0: cannot open shared object file: No such file or directory

Solution:

Since OpenSSL is installed on custom directory  (/usr/local/ssl) ,

Copy /u01/openssl-1.0.2g/libcrypto.so.1.0.0 & libssl.so.1.0.0  to /usr/lib64/
Create symbolic link
    # ln -s libssl.so.1.0.0 libssl.so
    # ln -s libcrypto.so.1.0.0 libcrypto.so
Test using ldd

# ldd mod_ssl.so

linux-vdso.so.1 =>  (0x00007fff5c39b000)
libssl.so.1.0.0 => /lib64/libssl.so.1.0.0 (0x00007f5ef492d000)
libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007f5ef44f7000)
librt.so.1 => /lib64/librt.so.1 (0x00007f5ef42ee000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f5ef40b7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ef3e9a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f5ef3b05000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ef3901000)
/lib64/ld-linux-x86-64.so.2 (0x0000003a23e00000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f5ef36fe000)

Start the apache httpd server now.

checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but cannot be built due to prerequisite failures

I am getting the below error while installing the Apache with SSL Module.

Issue:

checking whether to enable mod_slotmem_shm... shared (all)
checking whether to enable mod_slotmem_plain... shared (all)
checking whether to enable mod_ssl... checking dependencies
checking for OpenSSL... checking for user-provided OpenSSL base directory... none
checking for OpenSSL version >= 0.9.8a... FAILED

configure: WARNING: OpenSSL version is too old 
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but cannot be built due to prerequisite failures 

Solution: Upgrade OPEN SSL

Download the updated version of OpenSSL Unzip and run

$ mv /usr/bin/openssl /usr/bin/openssl_bkp
$ env LDFLAGS="-ldl" 

$ ./config -fPIC --prefix=/usr/local --openssldir=/usr/local/ssl shared

$ make depend
$ make
$ make test

$ make install

Reinstall Apache again


While running (configure) rm: cannot remove `libtoolT'

Issue: while running (configure) rm: cannot remove `libtoolT'

Solution:   

Edit your configure file

Change the line

$RM "$cfgfile"

to

$RM -f "$cfgfile"

This will resolve the error

rm: cannot remove `libtoolT': No such file or directory

Then try run configure.

Apache Installation on Linux

Below are the Prerequisite for installing the Apache on Linux.

1.    GCC Compiler

  $ yum groupinstall "Development Tools"   (this will also install GCC, apr and apr-util , but with legacy version,so install the latest apr in further steps)

2.    APR/APR-UTIL

Download the APR/APR-UTIL from the "https://apr.apache.org/" and run the below command as a root user.

APR

 $ ./configure
 $  make
$  make install

Which installs apr on /usr/local/apr

APR-UTIL:

$ ./configure --with-apr=/usr/local/apr
$  make
$ make install

3.    PCRE (perl)

Download the PCRE from the "https://apr.apache.org/" and run the below command as a root user.

Note: Also Install "yum install pcre-devel"  otherwise we might get error while installing apache like  "util_pcre.c:49:18: error: pcre.h: No such file or directory"

a.    ./configure --prefix=/usr/local/pcre
b.    make
c.    make install


Which installs apache on /usr/local/pcre

 Install Apache

Download Apache from the "https://httpd.apache.org/download.cgi" url and run the below comands on liux terminal.

Directory: /u01/httpd-2.4.20 
$ ./configure --prefix=/u01/Apache2.4.20 --enable-mods-shared=all --enable-so --enable-rewrite --enable-ssl --enable-proxy  --with-ssl=/usr/local/ssl
$ make
$ make install

Saturday, December 29, 2018

Configure Apache 2.x with Weblogic Server12c using WLS Plugin 12.c


Pre-Requisites

1.       Install Apache and Weblogic Server
2.       Create a Weblogic domain with two managed servers in a cluster.
3.       Make sure that you are able to access the application deployed on Weblogic from the Apache Installed Servers.
4.       Download Oracle WebLogic Server Proxy Plugins from the following link :

Configure Apache 2.x with Weblogic Server12.2.1.1.0 using WLS Plugin 12.2.1.1.0

1.       Unzip the downloaded WLS Plugin zip file to any location.
2.       Take a backup of httpd.conf file located in "<Apache_home>/conf" and make the following changes to it :
2.1   Add an entry for LoadModule as follows :
2.2   LoadModule weblogic_module /home/ApachePlugin12.2.1.3.0/lib/mod_wl.so
NOTE: Make sure that all the other .so files are present in the same location where "mod_wl.so" is located.
2.3   Add the following IfModule :
<IfModule mod_weblogic.c>
WebLogicHost xx.xx.xxx.xxx
WeblogicPort 7001
</IfModule>
<Location />
SetHandler weblogic-handler
</Location>
NOTE: Here we are forwarding the request to a single WLS server running on port 7001.
2.4   If you want to forward the request to a cluster you can use the following :
<IfModule mod_weblogic.c>
WebLogicCluster xx.xx.xxx.xxx:7003,xx.xx.xxx.xxx:7005
</IfModule>
<Location />
SetHandler weblogic-handler
</Location>
Here Weblogic server with port 7003 and 7005 are part of a cluster in Weblogic Server domain.
3.       Add the ${PLUGIN_HOME}/lib is included in the LD_LIBRARY_PATH:
$ export LD_LIBRARY_PATH=/home/ApachePlugin12.2.1.3.0/lib
(OR)
Alternatively, you can copy the content of "/home/ApachePlugin12.2.1.3.0/lib" to $APACHE_HOME/lib
OR
You can also edit $APACHE_HOME/bin/apachectl to update the LD_LIBRARY_PATH

Configure Apache 2.4 with Weblogic Server12.2.1.1.0 using WLS Plugin12.2.1.1.0  over one-way SSL

Request Flow

Client ----HTTP---> Apache ---HTTPS---> Weblogic
Weblogic ----HTTPS----> Apache -----HTTP-----> Client
Here Weblogic Server acts as an SSL Server and Apache acts as an SSL client.

Pre-Requisites

1.       Enable SSL on Weblogic domain. By default DemoIdentity and DemoTrust will be configured. You need to trust the root certificate of WLS in WLSPlugin.
2.       Make sure that you are able to access the application deployed on Weblogic over SSL from the Apache Installed Servers.

Steps to configure the SSL in Apache

1.       Create and configure wallet in Apache using the following commands.
Syntax: orapki wallet create -wallet my-wallet -auto_login_only
2.       Import the root certificate of Weblogic in wallet using the following command.
Syntax: orapki wallet add -wallet my-wallet -trusted_cert -cert /home/Oracle/Middleware/Oracle_Home/wlserver/server/lib/CertGenCA.der -auto_login_only
3.       Modify the IfModule in httpd.conf file as follows :
<IfModule mod_weblogic.c>
WebLogicCluster xx.xx.xxx.xxx:7003,xx.xx.xxx.xxx:7005
SecureProxy ON
WLSSLWallet /home/ApachePlugin12.2.1.3.0/bin/my-wallet”
</IfModule>
<Location />
SetHandler weblogic-handler
</Location>
4.       Restart the Apache WebServer
$ ./apachectl restart

Configure Apache 2.4 with Weblogic Server12.2.1.1.0 using WLS Plugin12.2.1.1.0  over two-way SSL

Request Flow

Client ----HTTP---> Apache ---HTTPS---> Weblogic
Weblogic ----HTTPS----> Apache -----HTTP-----> Client
Here Weblogic Server acts as an SSL Server and Apache acts as an SSL client.

Pre-Requisites

Create a self-signed certificate or Third Party CA Signed certs. You can refer to the following link for more details on the same

Steps to configure the 2 way SSL

1.       Enable two-way SSL :
Login to console -> +Environment -> Servers -> <Server_name> -> SSL -> +Advanced -> Select "Client-Cert Requested and Enforced" from the drop-down.
2.       Create and configure wallet in Apache using the following commands.
Syntax: orapki wallet create -wallet my-wallet -auto_login_only
3.       Import the root certificate of Weblogic in wallet using the following command.
Syntax: orapki wallet add -wallet my-wallet -trusted_cert -cert /home/Oracle/Middleware/Oracle_Home/wlserver/server/lib/CertGenCA.der -auto_login_only
4.       Create a self-signed certificate or Third Party CA Signed Certificates with wallet using the following commands.
Syntax: orapki wallet add -wallet "/home/ApachePlugin12.2.1.3.0/bin/my-wallet" -auto_login_only -dn "CN=celvpvm09188.us.oracle.com,OU=wls,O=wls,L=Bangalore,ST=Karnataka,C=IN" -keysize 2048 -self_signed -validity 2048
5.       Export the root certificate of the self-signed certificates or Third Party CA Signed Certificates we created in the previous step.
6.       List the contents of wallet.
7.       Modify the IfModule in httpd.conf file as follows.
<IfModule mod_weblogic.c>
WebLogicCluster xx.xx.xxx.xxx:7003,xx.xx.xxx.xxx:7005
SecureProxy ON
WLSSLWallet /home/ApachePlugin12.2.1.3.0/bin/my-wallet”
</IfModule>
<Location />
SetHandler weblogic-handler
</Location>
8.       Import the root certificate of Apache in Weblogic trust store.
Note: We are configuring SSL between Apache and WLS and not between the client and Apache.
The URL you access will be http://<apache_hostname>:<apache_port>/console.