Posts

How to redirect to specific tomcat port from nginx configuration

1: Create a file /etc/nginx/conf.d/example.conf 2: sudo chmod +x /etc/nginx/conf.d/example.conf 3: Copy this content and change the domain name according to you domain. server {     server_name  example.com;     rewrite ^(.*) http://www.example.com$1 permanent; } server {   listen          80 default_server;   listen [::]:80 default_server ipv6only=on;   server_name     www.example.com;   root            /opt/apache-tomcat-8.0.24/webapps/ROOT;   location / { proxy_set_header X-Forwarded-Host $host;         proxy_set_header X-Forwarded-Server $host;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_pass http://127.0.0.1:8080/;   } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; } }

Porxy for apache to tomcat redirect

1: Open file /etc/apache2/sites-enabled/000-default.conf 2: Change content 3: Restart apache2 <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost ProxyRequests Off     <Proxy *>         Order deny,allow         Allow from all     </Proxy>     ProxyPreserveHost on     ProxyPass / http://localhost:8080/ DocumentRoot /var/www/html # Available ...

Is the JVM a compiler or an interpreter?

First, let's have a clear idea of the following terms Javac  is Java Compiler -- Compiles your Java code into  Bytecode JVM  is Java Virtual Machine -- Runs/ Interprets/ translates Bytecode into  Native Machine Code JIT  is Just In Time Compiler -- Compiles the given bytecode instruction sequence to machine code at  run-time  before executing it natively. It's main purpose is to do heavy optimizations in performance. So now, Let's find answers to your questions.. 1) JVM: is it a compiler or an interpreter?  --  Ans:  Interpreter 2) what about JIT compiler that exist inside the JVM?  --  Ans:  If you read this reply completely, you probably know it now 3) what exactly is the JVM?  --  Ans: JVM is a virtual platform that resides on your RAM Its component,  Class loader  loads the  .class  file into the RAM The  Byte code Verifier  component in JVM checks if there ar...

Example AES technology

import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.apache.commons.io.IOUtils; public class Test {     /**      * @param args      */     public static void main(String[] args) {           System.out.println("Listing all table name in Database!");           Connection con = null;           String url = "jdbc:mysql://localhost:3306/";           String db = "test";           String driver = "com.mysql.jdbc.Driver";           String user = "root";           String pass = "root";           String name="";     ...

Heap size for JVM

Two JVM options are often used to tune JVM heap size: -Xmx for maximum heap size, and -Xms for initial heap size. Here are some common mistakes made by developers while using them: Missing m, M, g or G at the end (they are case insensitive). For example, java -Xmx128 BigApp java.lang.OutOfMemoryError: Java heap space The correct command should be: java -Xmx128m BigApp . To be precise, -Xmx128 is a valid setting for very small apps, like HelloWorld. But in real life, I guess you really mean -Xmx128m Extra space in JVM options, or incorrectly use =. For example, java -Xmx 128m BigApp Invalid maximum heap size: -Xmx Could not create the Java virtual machine. java -Xmx=512m HelloWorld Invalid maximum heap size: -Xmx=512m Could not create the Java virtual machine. The correct command should be java -Xmx128m BigApp , with no whitespace nor =. -X options are different than -Dkey=value system properties, where = is used. Only setting -Xms JVM option and its value is greater tha...

Encrypt MySQL data using AES techniques

CREATE   TABLE ` user ` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `first_name` VARBINARY(100) NULL , `address` VARBINARY(200) NOT NULL , PRIMARY KEY (`id`) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci   You may be expected the table structure should be: CREATE   TABLE ` user ` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `first_name` VARCHAR (50) NULL , `address` VARCHAR (100) NOT NULL , PRIMARY KEY (`id`) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci   To encrypt & decrypt mysql data we will use AES_ENCRYPT() and AES_DECRYPT() functions. These functions used the official AES (Advanced Encryption Standard) algorithm & encode data with a 128-bit key length. 128 bits is much faster and secure enough for most purposes. Why we used VARBINARY data type instead of VARCHAR : Because AES_EN...

How to Share Your 3G/4G Data Card Over Wifi with Ubuntu Linux

follow the link:: http://www.svsarana.com/share_3G_data_internet_over_wifi.php?redirect=1