Apache listen only on 127.0.0.1 (Nginx front-end etc.) and host multiple subdomains in Apache
vi /etc/apache2/ports.conf
NameVirtualHost 127.0.0.1 Listen 127.0.0.1:80Use this on vhosts
<virtualhost 127.0.0.1> </virtualhost>
vi /etc/apache2/ports.conf
NameVirtualHost 127.0.0.1 Listen 127.0.0.1:80Use this on vhosts
<virtualhost 127.0.0.1> </virtualhost>
ServerTokens OSto
ServerTokens Prod
ServerSignature Onto
ServerSignature Off
public function up()
{
$this->dbforge->add_field(array(
'Price' => array(
'type' => 'DECIMAL',
'constraint' => '10,2',
'unsigned' => FALSE
)
));
$this->dbforge->create_table('ads');
}
#Include conf/extra/httpd-vhosts.confit will be
Include conf/extra/httpd-vhosts.conf
Open C:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf to add/edit virtual hosts
NameVirtualHost *:80DocumentRoot "c:/wamp/www/" ServerName localhost ServerAlias www.localhost
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Countries_model extends CI_Model {
public function get_countries()
{
$query = $this->db->get('countries');
if ($query->num_rows() > 0) {
return $query->result();
} else {
return FALSE;
}
}
public function get_cache()
{
if ( ! $countries = $this->cache->get('countries')) {
$countries = $this->get_countries();
$this->cache->save('countries', $countries, 86400);
}
return $countries;
}
}
controller
$this->countries_model->get_cache();