Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Friday, July 3, 2015

Improve Apache Web Server Security

Improve Apache Web Server Security: Use ServerTokens and ServerSignature to Disable Header
When Apache HTTPD web server generates any web pages or error pages, some important information about the version and other details implemented on the system are displayed in the web site server header.

IE: Server: Apache/2.0.53 (Ubuntu) PHP/4.3.10-10ubuntu4 Server at xx.xx.xx.xx Port 80

Fix possible security issue, modify these two directives ServerTokes and ServerSignature in httpd.conf configuration file.

To ensure that the Apache HTTP web server does not broadcast this message to the whole world publicly and fix possible security issue,

modify these two directives

  • ServerTokes
  • ServerSignature

In httpd.conf configuration file.

Login as root user or perform a sudo to the web server.

Open and edit httpd.conf or apache2.conf (in Apache 2) with vi or other text editor. The Apache configuration normally located in /etc/httpd/conf/ or /etc/apache2/ or /etc/apache/ (for Apache1.3) depending on which Unix you’re using.

Locate the line with ServerTokens. You can perform a search by typing “/ServerTokes” and hit Enter.

In Apache 1.3, you will likely to see a line starts with #ServerTokes Full In this case, remove or delete the # character (by pressing d key).

Also modify the Full to become Prod (press r key to replace one character, or R to replace multiple characters), so that the line becomes ServerTokens Prod. 

In Apache 2.0 or 2.2, the line normally does not exist. So the search will fail. In this case, go to the bottom of config file, and add the new line with the following text. You can add new line by pressing o key.

ServerTokens Prod

Next, search for ServerSignature. In Apache13, the line should just above the line of ServerTokens. Edit the line so that it looks like this, and in Apache2 which doesn’t already have this line, add in at new one.

ServerSignature Off

By now the Apache configuration file should have this two directives set as below:

ServerSignature Off ServerTokens Prod


The first line “ServerSignature Off” instructs Apache not to display a trailing footer line under server-generated documents (error messages, mod_proxy ftp directory listings, mod_info output, and etc) which displays server version number, ServerName of the serving virtual host, email setting, and creates a “mailto:” reference to the ServerAdmin of the referenced document.

The second line “ServerTokens Prod” configures Apache to return only Apache as product in the server response header on very page request, suppressing OS, major and minor version info.

Save and close the config file by pressing Shift-Colon, and then type “wq” keys, and hit Enter.
Restart Apache. Typical command is 

service httpd restart or /etc/init.d/apache2 restart.

Now, you will get only the Apache in the server response header:

Server: Apache


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Thursday, April 16, 2015

Ubuntu Linux: Install or Add PHP-GD To Apache Web Server

The GD Graphics Library for dynamically manipulating images. You will need to compile PHP with the GD library of image functions for this to work. However. Ubuntu (and Debian) Linux comes with the package called php5-gd.
 Just type the following command to install this module:

 
# apt-get install php5-gd
 

OR


 
$ sudo apt-get install php5-gd
 


Finally, restart the Apache 2 web server, enter:


 
# /etc/init.d/apache2 restart
 




Now, you can test your php application.


How do I verify that php5-gd support loaded or not?

Type the following command at a shell prompt:


 
$ php5 -m | grep -i gd
 



Sample outputs:

 
   gd
 



OR


 
$ php5 -i | grep -i --color gd
 



OR


 
$ php -i | grep -i --color gd
 


Wednesday, April 8, 2015

Pagination Issue in Codeigniter [solved]

There is many students face problem in Pagination library in CI
CodeIgniter

Please update the following code and your problem resolved


public function index($index=1)
    {
        $per_page=2;   // set accorrding to requiremnet
       if($index==1){
           $index=0;
       }
         
         $this->load->model("MODLE_NAME");
            $user_data['user_data']=$this->Model_name->select($per_page,$index);
            $t=$this->Model_name;
            $table_name=$t::table_name;
            $query = $this->db->get($table_name);
            $row_count=$query->num_rows();
   // pagination     
       $this->load->library('pagination');

            $config['base_url'] = base_url().'admin/controller_function/index/';
            $num_rows_pagination=$row_count;
            $config['total_rows'] = $num_rows_pagination;
            $config['per_page'] = $per_page;
             $config['uri_segment'] = 4;
               // pagination formating
                    $config['full_tag_open'] = "<br><ul class='pagination'>";
                    $config['full_tag_close'] ="</ul>";
                    $config['num_tag_open'] = '<li>';
                    $config['num_tag_close'] = '</li>';
                    $config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
                    $config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
                    $config['next_tag_open'] = "<li>";
                    $config['next_tagl_close'] = "</li>";
                    $config['prev_tag_open'] = "<li>";
                    $config['prev_tagl_close'] = "</li>";
                    $config['first_tag_open'] = "<li>";
                    $config['first_tagl_close'] = "</li>";
                    $config['last_tag_open'] = "<li>";
                    $config['last_tagl_close'] = "</li>";
            
            $this->pagination->initialize($config); 
            $user_data['pagination']= $this->pagination->create_links();
            $user_data['total_row']=$row_count;
            $user_data['page'] = 'controller_function';
        $this->load->view('admin/Manage/view_page',$user_data);   // Customize according its to view panel
       
   }
 
                           //---------------WARNING------------ 
 
//================= YOUR MODEL and Controller According to your Project ================ 

Friday, March 20, 2015

Remove nginx and re activate apache

Remove nginx and re activate apache

 
//First, you need to stop nginx so it releases port 80 so that apache2 can listen to it later on.
-------------------------------------
sudo service nginx stop                                                           

//Next, if nginx was installed with apt-get, removing it would be as simple as

sudo apt-get remove nginx

//Instead, you can also use

sudo apt-get purge nginx

//First one removes all package files, while the second also removes the configuration files.
//If you intend to use nginx later on with the configuration you did, use remove. Else, I would suggest using purge.

//After removing nginx, you can restart apache to make sure it is listening to port 80.

sudo apache2ctl restart

//If you had removed apache before installing nginx, you can re-install it with

sudo apt-get install apache2 
 
 

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide If you're looking to host a Laravel project on Hostinger’s hPa...