3/23/15

Increase Tomcat Upload File Size Limit

Today while deploying xyz.war file (development site code) in Tomcat (version 7.057), I faced following issue regarding upload limit size in Tomcat.
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (128382112) exceeds the configured maximum (104828800)

Increase Tomcat Upload File Size Limit

To increase upload size limit in tomcat edit webapps/manager/WEB-INF/web.xml configuration file and search for below content.
# cd /path/to/tomcat
# vim webapps/manager/WEB-INF/web.xml
  <multipart-config>
  
      <max-file-size>52428800</max-file-size>
      <max-request-size>52428800</max-request-size>
      <file-size-threshold>0<</file-size-threshold>
   
  </multipart-config>
  
Edit max-file-size and max-request-size and increase it as your requirement. These values are defined in bytes and the default value is set to 50Mb.
After making all above changes, You need to restart Tomcat instance.

3/22/15

What is .htaccess File and Basic Uses

What is .htaccess ?

.htaccess (hypertext access) is a useful file for Many of web server to apply settings per directory basis. It allows to override default configuration of Apache server on run time. Using .htaccess we can easily enable or disable any functionality at the run time.
.htaccess is a complete file name, It’s not just the extension of file.
Be careful while working with .htaccess configuration. Any small mistake may stop your entire site. Most probably we get 500 error with any syntax error in .htaccess file.

Uses of .htaccess ?

We can use .htaccess to accomplish various tasks at the run time. Below is a list of some most frequently uses of .htaccess.

1. Redirect or Rewrite URLs

Using .htaccess we can easily redirect user from one url to other url easily. Also we can direct urls to other url without changing url in browser windows.

2. Enable Password Protection

Using .htaccess we can enable basic http authentication on entire site or on a specific directory access. It prevent unauthorized access of data.
  • Visit: How to Setup Basic Authentication in Apache with .htaccess
  • 3. Define Custom Error Pages

    When our website faces any error in backend, web server shows its pre defined error pages for each errors. We can redesign own error pages and show to end users in case of error occurred on site.

    4. Allow or Deny Users

    We can simply restrict any users to access entire site of specific pages of website based on there ip address. We can simple allow our secure pages to access from specific ips only. In that case if any user tried to access secure page from unauthorized pages will get error page.

    5. Change URLs

    .htaccess is widely used for changing website urls to make to simple and seo friendly. We can easily convert urls showing in web browser user-friendly.

    3/2/15

    Hot to Install lamp in Ubuntu 12.04,12.10, 13.04, 13.10,14.04,14.10 & LinuxMint 13

    LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform that uses Linux as operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.
    We did show you in our previous post how to install LAMP in Ubuntu 10.04 with one command using tasksel command. It is a software installation application that is an integral part of the Debian installer and works under Ubuntu Linux too. It groups some packages by tasks and offers the user an easy way to install the packages for that task. It provides the same functionality as using conventional meta-packages. in Maverick this command dosn`t come by default, so we need to install it first before to perform the LAMP installation.
    This tutorial was has been tested on Ubuntu 10.04, 10.10, 11.04, 11.10, 12.04 LTS Precise Pangolin. Also tested in LinuxMint13 and works fine.
    Open terminal and Type the command :install it first with
    sudo apt-get install tasksel
    sudo tasksel
    Now to install LAMP, type the taskel command in terminal :
    And select LAMP Server:
    During the installation you will be asked to insert the mysql root password
    Now check if php is working :
    $sudo vi /var/www/info.php
    save and exit. Restart apache2 ,
    #sudo /etc/init.d/apache2 restart
    Now open browser and type :
    http://ip/info.php or http://localhost/info.php
    Php is installed.
    To full manage your lamp Server database, install phpmyadmin
    sudo  apt-get  install  phpmyadmin
    To login to phpmyadmin, open browser and type :
    http://ip/phpmyadmin   or http://localhost/phpmyadmin


    Finally Lamp server installed your machine.

    FIND US ON FACEBOOK

    FIND US ON Twitter