Posts

Showing posts with the label Apache

How To Install Tomcat with Apache Web Server proxy on CentOS 6.5

Introduction This guide introduce how to install Tomcat container with apache web server. We will install following packages for this tutorial. Java Runtime Environment (CentOS build in repository - OpenJDK) Apache Web Server (CentOS build in repository) Compile and load mod_jk ( http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz ) Tomcat ( http://tomcat.apache.org/index.html ) Install Java Minimal CentOS installation will not install openjdk package. Verify the package installation rpm -qa |grep java Install Java yum install java-1.7.0-openjdk.x86_64 Verify with java command [root@demo-01 ~]# java -version java version "1.7.0_51" OpenJDK Runtime Environment (rhel-2.4.4.1.el6_5-x86_64 u51-b02) OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode) Install Apache Web Server We will install Apache web server as frontend and will proxy to tomcat container. Install Apache web server yum install httpd M...

Basic security for Apache

At production environment, it is not wise to show Apache server version. Edit /etc/httpd/conf/httpd.conf ServerSignature Off ServerTokens Prod TraceEnable off sed -i -e '/ServerSignature/ s/On/Off/' /etc/httpd/conf/httpd.conf sed -i -e '/ServerTokens/ s/OS/Prod/' /etc/httpd/conf/httpd.conf echo "TraceEnable off" >> /etc/httpd/conf/httpd.conf

How to setup JBoss Apache mod_jk

This note provides typical setup steps for Jboss application server. Initial setup Install Java Install apache-ant (Just need to extract the zip) Configure environment variable For example /root/.bash_profile ANT_HOME=/opt/ant PATH=/opt/java/bin:$ANT_HOME/bin:$PATH:$HOME/bin:./ JAVA_HOME=/opt/java export JAVA_HOME export PATH export CLASSPATH=/usr/java/jdk/lib/tools.jar:/usr/java/jdk/jre/lib/rt.jar:./ Install jboss GA version http://sourceforge.net/projects/jboss   Unzip it at /opt directory Configure environment variable /root/.bash_profile JBOSS_HOME=/opt/jboss export JBOSS_HOME Write init script to start Startup nohup /opt/jboss/bin/run.sh -b 0.0.0.0 & Shutdown opt/jboss/bin/shutdown -S Install mod_jk for apache proxying http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux Copy mod_jk.so to /etc/httpd/modules Edit httpd.config for mod_jk vi /etc/httpd/conf/httpd.conf Include conf/mod_jk.conf Create /etc/httpd/conf/mod_jk.c...

Fail to start Apache due to port occupied

At error log, make_sock: could not bind to address 0.0.0.0:443 or 80 The problem is with the port conflict Verify with lsof command: #lsof -i :80 Sample output bash 19089 root 18u IPv4 127053 TCP *:http (LISTEN) Kill conflict process #kill -9 19089 Check again #lsof -i :80 Start Apache #apachectl start

Active Passive setup with heartbeat drbd and Apache

Image
Heartbeat 2 + DRBD 8 + Apache Step 1 : Configure DRBD -> Follow DRBD configuration steps Step 2 : Give Virtual IP for HeartBeat ###At both machines ifconfig eth0:1 192.168.91.95 netmask 255.255.255.0 (put at /etc/rc.d/rc.local) Step 3 : Configure Apache Edit /etc/httpd/conf/httpd.conf Machine – 192.168.91.2 <VirtualHost 192.168.91.95> DocumentRoot /web <-- DRBD <Directory "/web"> allow from all Options +Indexes </Directory> ServerName 192.168.91.2 </VirtualHost> Machine – 192.168.91.3 <VirtualHost 192.168.91.95> DocumentRoot /web <-- DRBD <Directory "/web"> allow from all Options +Indexes </Directory> ServerName 192.168.91.3 </VirtualHost> Step 4: Installation and Configuration Heatbeat ###At Both machine rpm -ivh lm_sensors-2.8.7-2.40.3.i386.rpm rpm -ivh heartbeat-pils-2.0.8-2.el4.centos.i386.rpm rpm -ivh heartbeat-stonith-2.0.8-2.el4.centos.i...

MYSQL auth with apache .htaccess

MySQL authentication provides a more flexible and powerful system than Basic or Digest authentication. All the username's and passwords can be in database which provides capability to standardize among all web servers. Module: mod_auth_mysql Configure following parameters at .htaccess file AuthType: This need to be Basic. AuthName: This is the name (realm) you want to give to your password protected site. Auth_MYSQLhost: Your MySQL database hostname. Auth_MYSQLusername: Your MySQL database username. Auth_MYSQLpassword: Your MySQL database password. Auth_MYSQLdatabase: This is your database with the member's info. Auth_MYSQLpwd_table: The members info table containing (Apache username/password). Auth_MYSQLuid_field: The username field. Auth_MYSQLpwd_field: The password field. Auth_MYSQL_EncryptedPasswords: Are the password MySQL encrypt. [onoff]. require valid-user Ref: https://www.widexl.com/tutorials/htaccess.html

Increase PHP upload file size

Come across to increase PHP upload file size is very common in Linux, Apache, MySQL, and PHP (LAMP) environment. Edit /etc/php.ini 1. max_execution_time = 30 -> 300 2. memory_limit = 8M -> 16MB 3. post_max_size = double of upload size e.g upload size 10 MB -> post_max_size 20 MB 4. upload_max_filesize = 10M Edit /etc/httpd/conf.d/php.conf Change LimitRequestBody