Import Excel Data into MySQL

Sunday, April 16, 2017

Import Excel Data into MySQL :-

To import data from Excel is very simple using the LOAD DATA command from the MySQL Command prompt. there are following steps.

Step 1. Save your Excel data as a csv file (In Excel 2007 using Save As)

Step 2. Check the saved file using a text editor such as Notepad to see what it actually looks like, i.e. what delimiter was used etc.

Step 3. Start the MySQL Command Prompt (or MySQL Query Browser – Tools – MySQL Command Line Client to avoid having to enter username and password etc.)

Step 4. Enter this command:
           LOAD DATA LOCAL INFILE 'C:\\temp\\myfile.csv' INTO TABLE database.table FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (field1, field2);

Step 5. Done

Read more...

Setting up Monit with tomcat

Setting up Monit with tomcat :-


Monit is used for monitoring and restarting services when services are down, it can alert you or just restart after 3 or 5 failed connects/attempts. It handles everything from load, disk space,  memory, services, and other things. we can easily configure it.

Step 1. To install 

            On Debian/Ubuntu based:-
            apt-get install monit

           On Centos :-
           1. Our system's hostname is site1.example.com, and we have a web site www.example.com on it with the document root /var/www/www.example.com/web.

            2. Need To Enable The RPMforge Repository :-
             On i386 hosts
             wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
             rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

             rm -f rpmforge-release-0.3.6-1.el5.rf.i386.rpm

            On x86_64 hosts
            wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
            rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

            rm -f rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

            3. Need to Install And Configure munin :-
             yum install munin munin-node

            Then we create the system startup links for munin and start it:
            chkconfig --levels 235 munin-node on
            /etc/init.d/munin-node start

Next, we must edit the munin configuration file /etc/munin/munin.conf. We want munin to put its output into the directory /var/www/www.example.com/web/monitoring, therefore we change the value of htmldir, and we want it to use the name site1.example.com instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with site1.example.com. Without the comments, the changed file looks like this:
vi /etc/munin/munin.conf

          [...]
         dbdir   /var/lib/munin
         htmldir /var/www/www.example.com/web/monitoring
         logdir  /var/log/munin
         rundir  /var/run/munin

        # Where to look for the HTML templates
        tmpldir /etc/munin/templates
        [...]
        # a simple host tree
        [site1.example.com]
        address 127.0.0.1
        use_node_name yes
        [...]
         
        mkdir -p /var/www/www.example.com/web/monitoring
         chown munin:munin /var/www/www.example.com/web/monitoring
        /etc/init.d/munin-node restart

         4. Password-Protect The munin Output Directory (Optional)
             we can create an .htaccess file in /var/www/www.example.com/web/monitoring:
         
             vi /var/www/www.example.com/web/monitoring/.htaccess

             AuthType Basic
             AuthName "Members Only"
            AuthUserFile /var/www/www.example.com/.htpasswd
           
                require valid-user
           

              Then we must create the password file /var/www/www.example.com/.htpasswd. We want to log in with the username admin, so we do this:
htpasswd -c /var/www/www.example.com/.htpasswd admin

             Enter a password for admin

Step 2:- Tomcat Monitoring Method A.

             
             echo "check host tomcat with address localhost
             stop program = "/etc/init.d/tomcat stop"
             start program = "/etc/init.d/tomcat restart"
             if failed port 8080 and protocol http
             then start
              " > /etc/monit.d/tomcat
              /etc/init.d/monit restart

Step 3:- Tomcat Monitoring Method B.


             check process tomcat with pidfile "/var/run/tomcat/tomcat.pid"
             start program = "/usr/local/tomcat/bin/startup.sh"
            as uid tomcat gid tomcat
            stop program = "/usr/local/tomcat/bin/shutdown.sh"
            as uid tomcat gid tomcat
            if failed port 8080 then alert
           if failed port 8080 for 5 cycles then restart
         
           Then edit your catalina.sh and set

            CATALINA_PID to be /var/run/tomcat/tomcat.pid
            JAVA_HOME=/usr/java/jdk


Then of course create the pid directory

mkdir /var/run/tomcat/
chown tomcat.tomcat /var/run/tomcat/

Step 4:- MySQL Monitoring 


           Add this to your my.cnf under [mysqld]

           pid-file=/var/run/mysqld/mysqld.pid
           and this to your monit config

           check process mysql with pidfile /var/run/mysqld/mysqld.pid
           group database
           start program = "/etc/init.d/mysql start"
           stop program = "/etc/init.d/mysql stop"
          if failed host 127.0.0.1 port 3306 protocol mysql then restart
          if 5 restarts within 5 cycles then timeout
          depends on mysql_rc

          check file mysql_rc with path /etc/init.d/mysql
          group database
         if failed checksum then unmonitor
         if failed permission 755 then unmonitor
         if failed uid root then unmonitor
         if failed gid root then unmonitor

Step 5:- Disk Space Monitoring


Add this to your monit config
check filesystem with path /dev/xvda1
      if space usage > 95% then alert
      if inode usage > 95% then alert


Step 6:- SSH Monitoring


Add this to your monit config

check process sshd with pidfile /var/run/sshd.pid
   start program  "/etc/init.d/sshd start"
   stop program  "/etc/init.d/sshd stop"
   if failed port 22 protocol ssh then restart
   if 5 restarts within 5 cycles then timeout


reloaded your monit config
























Read more...

How to clear Command line history in Linux/Centos

Sunday, March 19, 2017

How to delet Command line history in Linux/Centos :-



Clear Command line history in Linux/Centos -
There are lot of ways to clear Command line history.

1. Clear entire Command line history using ‘history’ command


To view the recently-executed commands -

>history

To clear the history, just run any one of the following command after you’re done:

>history -c

Or

>history -cw


2. Clear a Command line history using by inserting a blank space before each command


   using this way, we can clear/delete any particular command from the history. we need to put a blank space before any command. The command will not be recorded in history.

To do that, you must set HISTCONTROL environment variable’s value as “ignorespace” or “ignoreboth”.

export HISTCONTROL=ignorespace

Now, Let us see an example. I ran the following commands. And, I put a blank space in-front of the last command.

>clear

>uname -a

>sudo pacman -Syyu

>sudo wifi-menu

>ls

>sudo ping example.com


Now, run the ‘history’ command to view the recent-executed commands.

history
Sample output:

 3 clear
 4 export HISTCONTROL=ignorespace
 5 clear
 6 uname -a
 7 sudo pacman -Syyu
 8 sudo wifi-menu
 9 ls
 10 history

3. Clear or delete specific commands from history

This is another useful way to delete a particular command. Sometimes you might want to delete some critical commands, which causes damage to the system, from the history. This method will be helpful if you don’t want to clear the entire history.

Let us see an example. I ran the following commands.

>clear

>cal

>time

>ls

>uname -r

display the history command output:

history
sample output:

 3 clear
 4 cal
 5 time
 6 ls
 7 uname -r

 8 history

As you see in the above output, the history command displays the recently-executed commands.

To clear or delete a particular command from the history, do:

history -d
Here represents the line number of each command. For example, let us delete the “time” command with line number “5” from the history.

To do so, run:

history -d 5
Now, display the command line history to see if the command is remove or not.

history
Sample output:

 3 clear
 4 cal
 5 ls
 6 uname -r
 7 history
 8 history -d 5
 9 history


4. Delete Command line history permanently


One problem of using all above methods is they will only remove the commands from the active session i.e currently opened Terminal. That means if you have multiple Terminals running different commands, the ‘history’ command will only delete the history from where you run this command. The commands from other Terminals will still be available.

To remove all commands from history in all sessions (Terminals), you must remove the contents of .bash_history file. As you might know already, this file holds the list of commands that we run in the Terminal over time.

You can either clear this file manually each time or setup a cron job to clear it at regular intervals.

To clear the contents of this file manually each time, run:

cat /dev/null > ~/.bash_history
Like I said, this will delete the entire history of all sessions. The next day, however, this file will start to record the history. You should run this command everyday to clear the contents of this file.

Alternatively, you can schedule this task at regular interval using cron jobs.

To do so, run:

crontab -e
Add the following commands:

00 20 * * * cat /dev/null > ~/.bash_history


Why shouldn’t we clear Command line history?


Clearing Command line history is a good practice, however you must not clear history in some cases. Say for example, you want to repeat a command often. Would you type the command every time? That’s not necessary. Like I said already, the commands that you run on the Terminal will be retained in the ~/.bash_history file. Just hit the upper arrow in the keyboard, the list commands that you run recently will appear. Keep hitting the upper arrow key until you find the command that you want to run. Once you find the command that you want to run, just hit ENTER to execute. That’s it. You don’t have to type the command each time. Also, sometimes you won’t remember exactly how you executed a command in a previous session. In such cases, history command will come in help.

Read more...

How to Convert SSL Certificate File from CRT TO DER TO PEM Format?

Saturday, March 11, 2017

How to Convert SSL Certificate File from CRT TO DER TO PEM Format :-

There are following steps :-

1. Open a putty session to the Secure VM

2. Copy the obtained CRT file from the CSR to the working directory

3. Run the following command to first convert the CRT file to a DER file:
openssl x509 -in example.crt -out openssl.der -outform DER
             (Substitute example.crt as your current CRT filename)

4. Then run the following command to convert the openssl.der file which we just created, to a PEM file
openssl x509 -in openssl.der -inform DER -out openssl.pem -outform PEM

5. There you go.  Now you have a openssl.pem file which works for Netmail Secure.


Read more...

Restarting Linux Services using Command Line

Wednesday, March 1, 2017

Restarting Linux Services using Command Line:-


How to restart some listed services using command line in Linux/Centos/Ubuntu Server.

Lot of Services Example here.

1. Plesk Control Panel
    You can restart the Plesk interface by logging into your server using SSH & using the following command.

   etc/init.d/sw-cp-server restart


2. Email Services
   You can restart the email service by running the following commands.

   1) Restart qmail

     etc/init.d/qmail restart

   2) Restart Postfix 

       postfix stop
       postfix start

    3) Restart IMAP

      /etc/init.d/courier-imap stop
      /etc/init.d/courier-imap start


3. Webservices
    You can restart your webservices like httpd/apache2 by using the following command.

    1) Ubuntu

       /etc/init.d/apache2 restart

    2) CentOS

       /etc/init.d/httpd restart


4. DNS Services
    IF your websites are not being displayed, subdomains not displaying, issues with IPv4 and IPv6 address or getting error messages relating to dnsmg. You can restart your DNS services by running the following command.

    /etc/init.d/bind9 restart


5. MySQL database Services
    you can restart the service by using the following command.

   /etc/init.d/mysql restart


6. Unsure what service to reset?
      The following command will restart several services together.

     /etc/init.d/psa restart

Read more...

How To Find A Particular Text String In Files/Directory Linux

How To Find A Particular Text String In Files/Directory Linux :-


There are around thousands of text files on any Linux/Centos/Ubuntu or Unix based server. Need to Find and locate those files can be done with the find command.

You need to use the grep command. The grep command searches the given input Files for lines containing a match or a text string.

grep command syntax

The syntax is:

grep "your search string" directory-path

OR

grep [option] "your search string" directory-path

OR

grep -r "your search string" directory-path

OR

grep -r -H "your search string" directory-path

OR

egrep -R "word-1|word-2" directory-path

OR

egrep -w -R "word-1|word-2" directory-path


All Examples :-

Example 1.
In this example, search for a string called ‘my handler’ in all text (*.txt) files located in /home/user/ directory, use:

$ grep "my handler" /home/user/*.txt

OR
$ grep "my handler" ~/*.txt

Example 2.
Search all subdirectories recursively
You can search for a text string all files under each directory, recursively with -r option:
$ grep -r "my handler" /home/user/

OR
$ grep -R "my handler" /home/user/

Example 3.
Only display filenames
By default, the grep command prints the matching lines. You can pass -H option to print the filename for each match:
$ grep -H -r "my handler" /home/user

Sample outputs:

myfile.txt: my handler
handler.txt: my handler
...
To just display the filename use the cut command as follows:
$ grep -H -R somy /etc/* | cut -d: -f1

Sample outputs:

myfile.txt
handler.txt
......

Example 4.
Suppress file names
The grep command shows output on a separate line, and it is preceded by the name of the file in which it was found in the case of multiple files. You can pass the -h option to suppress inclusion of the file names in the output:
$ grep -h -R 'main()' ~/projects/*.c

Example 5.
Display only words
You can select only those lines containing matches that form whole words using the -w option. In this example, search for word ‘getMyProfile()’ only in ~/projects/ dirctory:
$ grep -w -R 'getMyProfile()' ~/projects/

Example 6.
Search for two or more words
Use the egrep command as follows:
$ egrep -w -R 'word1|word2' ~/projects/

Example 7.
Hide warning spam
grep command generate error message as follows due to permission and other issues:

No such file or directory
No such device or address
Permission denied

To hide all errors or warning message spam generated by the grep command, append 2>/dev/null to grep command. This will send and hide unwanted output to /dev/null device:
$ grep -w -R 'getMyProfile()' ~/projects/ 2>/dev/null

Example 8.
Display matched text in color
Pass the --color option to the grep command display matched text/words in color on the terminal:

grep --color 'word' file
grep --color -R 'word' /path/to/dir
grep --color -R "192.168.1.5" /etc/
grep --color -R -h "192.168.1.5" /etc/
grep --color -R -h "192.168.1.5" /etc/ 2>/dev/null
Sample outputs:

Fig.01: grep command in action with colors and hiding the warnings on screen
Fig.01: grep command in action with colors and hiding the warnings on screen

Example 9.
Ignore case
Our final example ignore case distinctions in both the search PATTERN and the input files:
grep -i -R 'word' /path/to/dir
grep -i -r 'income tax return' ~/accountingfiles/

Read more...

How To Restart IMAP Services ( dovecot IMAP server )

How To Restart IMAP Services ( dovecot IMAP server ) :-


How do I restart dovecot IMAP4 / IMAP in RHEL / CentOS / Fedora / Debian / Ubutnu Linux ?

Normally The default IMAP server port number is 143
In Linux you can install different IMAP servers also

Restart Dovecot IMAP mail server :-

Type the following command to start / stop and restart server under RHEL / CentOS / Fedora Linux:
# service dovecot start
# service dovecot stop
# service dovecot restart

Automatically reload sever next boot, enter:
# chkconfig dovecot on

To turn off auto loading on next boot, enter:
# chkconfig dovecot off



A Note About Debian / Ubuntu Linux User

Type the following command to start / stop and restart server under Debian / Ubuntu Linux:
# /etc/init.d/dovecot start
# /etc/init.d/dovecot stop
# /etc/init.d/dovecot restart

Use a text-based application called sysvconfig that allows you to configure which services are started at boot time for each runlevel including dovecot under Debian / Ubuntu Linux:
# sysvconfig

Read more...

Logs coming with systemd messages: Created slice & Starting Session

Logs coming with systemd messages: Created slice & Starting Session :-

Normally thiss issue is come Centos/Linux/RHEL7 newely installed system. when i check following in /var/log/messages all the time show.

Aug 23 06:40:20 example.com systemd: Created test user-0.test.
Aug 23 06:40:20 example.com systemd: Starting Session 150 of user root.
Aug 23 06:40:20 example.com systemd: Started Session 150 of user root.
Aug 23 06:40:20 example.com systemd: Created test user-0.test.
Aug 23 06:40:21 example.com systemd: Starting Session 151 of user root.
Aug 23 06:40:22 example.com systemd: Started Session 151 of user root.

Solution :-
These messages are normal and expected -- they will be seen any time a user logs in

To suppress these log entries in /var/log/messages, create a discard filter with rsyslog, e.g., run the following command:

echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf

Then restart the rsyslog service

systemctl restart rsyslog

Read more...

How to set initial value and auto increment in MySQL ?

Monday, February 27, 2017

How to set initial value and auto increment in MySQL ?


we can use below command -

ALTER TABLE employee AUTO_INCREMENT=1001;

or if you haven't already added an id column, also add it

ALTER TABLE employee ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    ADD INDEX (id);


Example :-

MySQL - Setup an auto-incrementing primary key that starts at 20001:

Step 1.  create your table:

create table employee(
  id       int(11) auto_increment, 
  name varchar(40),
  PRIMARY KEY (id)
)

Step 2 set the start number for auto increment primary key:

ALTER TABLE employee AUTO_INCREMENT=20001;

Step 3 insert some rows:-

insert into employee (name) values("pappu");
insert into employee(name) values("mamu");

Step 4, interpret the output:

select * from employee

'20001', 'pappu'
'20002', 'mamu'


If you need to add column for auto increment

alter table employee add column id int(5) NOT NULL AUTO_INCREMENT FIRST

This query for add column at first. Now you have to reset auto increment initial value. So use this query 

alter table employee AUTO_INCREMENT=20001


Read more...

How to change the default charset of a MySQL table ?

How to change the default charset of a MySQL table ?


If you want to change the table default character set and all character columns to a new character set, use a statement like this:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;

So query will be:

ALTER TABLE employee CONVERT TO CHARACTER SET utf8;

Read more...

How to reset AUTO_INCREMENT in MySQL ?

How to reset AUTO_INCREMENT in MySQL ?


How can we reset the auto-increment of a field in Mysql ?

We can reset the counter with following command :-

ALTER TABLE tablename AUTO_INCREMENT = 1

Read more...

How to install & configure SAR on CentOS/RHEL

Sunday, February 12, 2017

How to install & configure SAR on CentOS/RHEL:-

SAR (System Activity Reporter) is an important tool that helps system administrator to get a review of the server box with status of different critical metrics at different points of time. Using sar command you can monitor performance of different Linux subsystems (CPU, Memory, I/O etc..) in real time. The sar command extracts and write to standard output records previously saved in a file.

How To Install SAR:-

You can install it using YUM command. Use following command to install SAR.

# yum install sysstat


How To Check SAR :-

Once installed, verify the sar version using following command:

# sar -V
 
sysstat version 9.0.4
(C) Sebastien Godard (sysstat  orange.fr)

Collect the statistics using cron job :-

Create sysstat file under /etc/cron.d directory that will collect the historical sar data.

# cat /etc/cron.d/sysstat

# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

1. So the first cron entry will run every 10 minutes which will call the sadc utility and collect system stats and store it in a binary file.
2. And the second cron entry will dump all the contents of that binary file into another text file.

By default 7 days statistics, So you can modify that HISTORY entry easily by editing the file.

# cat /etc/sysconfig/sysstat

# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=28

By default all the statistics will save /var/log/sa location.

# cd /var/log/sa
 

Read more...

wget: unable to resolve host address `http'

wget: unable to resolve host address `http'


when i run wget command with any site than got below error

$ wget example.com 

--2016-07-18 15:34:12--  http://example.com/

Resolving http (http)... failed: Name or service not known.

wget: unable to resolve host address `http'


 Issue :- The issue is The DNS server seems out of order.
 Solution :- You can use another DNS server such as 8.8.8.8. and Put nameserver 8.8.8.8 to the first line of /etc/resolv.conf


Read more...

Backup Failed Mysqldump Got Errno 28 On Write

Saturday, February 4, 2017

Backup Failed Mysqldump Got Errno 28 On Write

What is Error Message
Backup failed: mysqldump: Got errno 28 on write

Meaning of this error
Insufficient disk space to store output.

Solution of this error
Free up some disk space. You might want to track down the reason you're low on disk space too.

Read more...

How to repair MySQL databases and tables

How to repair MySQL databases and tables

To repair MySQL databases and tables there are below steps

1. Backing up the databases


Step 1: Stop mysql
         service mysqld stop

Step 2: Use Below command to copies all of the files from all of your databases to a directory name based on the current time (more precisely, the number of seconds elapsed since January 1, 1970). This ensures that each database backup is stored in a directory that has a unique name. For added protection, you can (and should) back up the database files to a remote location not on the server.

      cp -rfv /var/lib/mysql /var/lib/mysql$(date +%s)

Step 3: Start mysql
            service mysqld start

2. Checking and repairing a table with mysqlcheck 

   After you back up your databases, you are ready to start troubleshooting. The mysqlcheck program enables you to check and repair databases while MySQL is running. This feature is useful when you want to work on a database without stopping the entire MySQL service.

Additionally, mysqlcheck works on tables that use the MyISAM or InnoDB database engines.

Step 1. To use mysqlcheck  As the root user
           cd /var/lib/mysql

Step 2. Replacing DATABASE with the name of the database that you want to check:
           mysqlcheck DATABASE

The above command checks all of the tables in the specified database. Alternatively, to check a specific table in a database, type the following command. Replace DATABASE with the name of the database, and replace TABLE with the name of the table that you want to check:

           mysqlcheck DATABASE TABLE

Step 3: Mysqlcheck checks the specified database and tables. If a table passes the check, mysqlcheck displays OK for the table. However, if mysqlcheck reports an error for a table, type the following command to try to repair it. Replace DATABASE with the database name, and TABLE with the table name:
mysqlcheck -r DATABASE TABLE





Read more...

How To Run Nginx with different port other than 80

How To Run Nginx with different port other than 80

To start nginx via different port(other than 80) there are below steps.

Step 1: Open your config file
            vi /etc/nginx/conf.d/default.conf

Step 2: Change port number on which you are listening;
            listen       81;
           server_name  localhost;

Step 3: Add a rule to iptables
           vi /etc/sysconfig/iptables
           -A INPUT -m state --state NEW -m tcp -p tcp --dport 81 -j ACCEPT

Step 4: Restart IPtables
            service iptables restart;

Step 5: Restart the nginx server
            service nginx restart

Step 6: Now Access your nginx server files on port 81

Read more...

How To Install nginx on CentOS 6 Using yum

How To Install nginx on CentOS 6 with yum


there are below step to install nginx on centOS 6 using Yum Command.

Install From Repository

if you want to install nginx from repository than start from step 1 otherwise start from step 5.

Step 1. cd /etc/yum.repos.d

Step 2. Create a repo configuration file for Nginx
           vi nginx.repo

Step 3. Put the following lines to nginx.conf
           [nginx]
           name=nginx repo
           baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
           gpgcheck=0
           enabled=1

Step 4. Save changes and exit the text editor.

Step 5. install EPEL
             EPEL is fo Extra Packages for Enterprise Linux. yum as a package manager does not include the latest version of nginx in its default repository, son need to install EPEL, will make sure that nginx on CentOS stays up to date.
          command prompt> sudo yum install epel-release

Step 6. Install nginx
           command prompt> sudo yum install nginx

Step 7. Start nginx
           command prompt> sudo /etc/init.d/nginx start


Configure Nginx

Step 1. Open the Nginx configuration file
           vi /etc/nginx/nginx.conf

Step 2. Modify the worker_process value to reflect the number of processor cores installed in the server.
           worker_processes 2

Step 3. To enable gzip compression, find the following line:
           #gzip on
          And uncomment it
          gzip on

Step 4. Save changes and exit the text editor.
    
Step 5. Restart the Nginx daemon to apply your changes.
            service nginx restart

Step 6. Configure Nginx to automatically start after reboot.
            chkconfig nginx on


Configure The Default Website

Step 1. Open the default website configuration file.
            vi /etc/nginx/conf.d/default.conf

Step 2. To set the listening port, find the following line and modify it’s value:
            listen 80;

Step 3. Set the DNS hostname of your website by finding the following line and replacing localhost with the name of your server.
           server_name localhost;

Step 4. The default website root directory is /usr/share/nginx/html. To change it, find the following lines and replace the highlighted value with the desired file path.

          location / { 
                  root /usr/share/nginx/html; 
                  index index.html index.htm; 
          }

5. To modify the default index file, add to or replace the values listed next to index.

6. Save changes and exit the text editor.


Configure Firewall To Allow HTTP Access

Step 1. Run the following command to allow HTTP access through IPTables.
            iptables -A INPUT -m state --state NEW -P tcp --dport 80 -j ACCEPT

Step 2. To permanently save the firewall rule, run the following command.
            /sbin/service iptables save





























Read more...

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP