Installing LEMP Ubuntu 14.04

After watching tutorial about nginx, got me thinking trying my own… I’m using Ubuntu 14.04 using rackspace here are my steps on installing the LEMP (Linux Nginx Mysql Php), why ubuntu 14.04?
what is new in ubuntu 14.04

Supported for five years by Canonical
Certification as a guest on AWS, Microsoft Azure, Joyent, IBM and HP Cloud
Updates to Tomcat (v7), Postgresql (v9.3), Docker v(0.9), Puppet (v3.0), Qemu (v2.0), Libvirt (v1.2), LXC (v1.0) and MySQL (v5.5)
The first production release of Open vSwitch 2.0 with full kernel integration
Runs on x86, x86-64, ARM v7, ARM64 and Power

NGINX

     sudo apt-get update
          sudo apt-get install nginx
               sudo nano /etc/nginx/nginx.conf

Set Rackspace firewall after install webserver

MYSQL

          sudo apt-get install mysql-server
          sudo mysql_install_db
          sudo mysql_secure_installation
          mysql -u root -p

PHP

          sudo apt-get install php5-fpm php5-mysql
          sudo nano /etc/php5/fpm/php.ini
          sudo service php5-fpm restart
          sudo nano /etc/nginx/sites-available/default
          configure
               from default
               to new
               only this
               sudo nano /etc/nginx/nginx.conf
          sudo service nginx restart
          
          sudo nano /usr/share/nginx/html/info.php

Googleapp email setting

First check http://mxtoolbox.com

So not to forget,

Host Record          Priority          Mail Server
@                                           1                      ASPMX.L.GOOGLE.COM.
@                                           5                      ALT1.ASPMX.L.GOOGLE.COM.
@                                           5                      ALT2.ASPMX.L.GOOGLE.COM.
@                                           10                    ASPMX2.GOOGLEMAIL.COM.
@                                           10                    ASPMX3.GOOGLEMAIL.COM.

Connecting mysql to a different server

When I tried to connect to a different server it says error with the database, then I tried to connect using linux command line then an error occured

ERROR 1130 (HY000): Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server

then found out that I need to make a user with priviledge and allow to certain domain / all.

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;

Good explanation
http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server

Unable to load your default controller – Nginx

I was testing my CI in Nginx from Apache and this what happened

Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid

What happened is when you’re using HMVC sometimes people delete their default controller, model or even library folder, In apache maybe it’s okay but not in Nginx not good.
Thanks http://ellislab.com/forums/viewthread/115746/#881355

Summary of happy investing

Waktu perdagangan untuk melakukan transaksi di bagi berdasarkan segment pasar
Segment pasar senin – kamis Jumat senin – kamis Jumat
Pasar regular 9:30 – 12:00 09:30 – 11:30 13:30 – 16:00 14:00-16:00
Pasar Negosiasi 9:30 – 12:00 09:30 – 11:30 13:30 – 16:00 14:00-16:00
Pasar Tunai 9:30 – 12:00 09:30 – 11:30 Close Close
Jenis Resiko
- Country Risk
Jika anda saat itu berinvestasi saham apa yang seharusnya anda lakukan
> Jawabannya mudah tapi harus diakui sangat sulit pelaksaaannya. Secara teori anda harus segerah mengalihkan uang anda dari pasar saham kepada pasar uang (obligasi atau deposito).
- Exchange Risk
Resiko ini berkaitan dengan perubahan nilai tukar mata uang sebuah negara terhadap mata uang negara lainnya. Perubahan nilai tukar menjadi berbahaya jika terjadi secara drastis dan dalam tempo singkat. Sementara jika penguatan sebuah mata uang secara signifikan akan merangsang terjadinya deflasi yang merugikan ekonomiAkibat langsung dari deflasi adalah melemahnya pertumbuhan akibat tertutupnya pasar ekspor.
- Business Risk
Resiko bisnis adalah resiko yang muncul secara alami dan sangat sulit, atau dapat dikatakan tidak mungkin untuk menghilangkannya. Namun resiko tersebut dapat dipindahkan seperti yang dilakukan oleh perusahaan sepatu merek nike dmn mereka memilih untuk mengoutsourcekan keseluruhan proses produksi kepada perusahaan lain yang bersedia.
- Financial risk
Ada banyak cmetode pembiayaan yang bisa dipilih sebuah perusahaan untuk mendapatkan dana seghar. di antaranya obligasi, pinjaman bank saham dan waran. Setiap pilihan memberikan konsekuensi berbeda dan memunculkan financial risk bagi sebuah perusahaan.
- Market Risk.
Market risk dari suatu saham dapat diukur dengan komponen yang dikenal sebagai Beta.
Kenapa memilih berhutang?
Padahal hutang berpotensi memberi dua pukulan telak kepada sebuah perusahaan saat krisis melanda. Jawabannya cukup kompleks, tetapi secara sederhana hutang dapat membantu sebuah perusahaan berlari lebih cepat tanpa perlu tambahan modal. Jika bunga hutang jauh lebih kecil dibandingkan keuntungan usaha, pilihan berhutang tidak sepenuhnya buruk.
Liquidity risk
Resiko ini lebih berkaitan dengan nilai kapitalisasi dan bersarnya transaksi sebuah saham.
Emotional risk
Resiko ini berkaitan dengan diri anda sendiri dan tidak ada hubungannya sama sekali dengan faktor di luar diri anda. emosi manusia seperti amarah, gembira, tidak pd, sedih, serakah, kikir, sombong, ceroboh dan sebagai sangan dominan dalam resiko ini.
Teman atau kawan.
Api secara teori adalah benda beresiko, dapat membantu kehidupan umat manusia apabila digunakan dengan pemahaman serta cara pengendalian resiko yang tepat.

Creating Installer Using Codeigniter

config.php

$config['installed'] = 'no';

routes.php

if (config_item('installed') == 'no')
{
      $route["default_controller"] = "install";
}

core/MY_Config.php

config_path          = APPPATH.'config/config'.EXT;
          $this->database_path     = APPPATH.'config/database'.EXT;
     }
    
     // --------------------------------------------------------------------

     /**
     * Update the config file
     *
     * Reads the existing config file as a string and swaps out
     * any values passed to the function.  Will alternately remove values
     *
     *
     * @access     public
     * @param     array
     * @param     array
     * @return     bool
     */
     function config_update($config_array = array())
     {
          if ( ! is_array($config_array) && count($config_array) == 0)
          {
               return FALSE;
          }

          @chmod($this->config_path, FILE_WRITE_MODE);

          // Is the config file writable?
          if ( ! is_really_writable($this->config_path))
          {
               show_error($this->config_path.' does not appear to have the proper file permissions.  Please make the file writeable.');
          }

          // Read the config file as PHP
          require $this->config_path;

          // load the file helper
          $this->CI =& get_instance();
          $this->CI->load->helper('file');

          // Read the config data as a string
          $config_file = read_file($this->config_path);

          // Trim it
          $config_file = trim($config_file);


          // Do we need to add totally new items to the config file?
          if (is_array($config_array))
          {
               foreach ($config_array as $key => $val)
               {              
                    $pattern = '/$config[\''.$key.'\']s+=s+[^;]+/';
                   $replace = "$config['$key'] = '$val'";             
                  $config_file = preg_replace($pattern, $replace, $config_file);
               }    
          }
         
          if ( ! $fp = fopen($this->config_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))
          {
               return FALSE;
          }

          flock($fp, LOCK_EX);
          fwrite($fp, $config_file, strlen($config_file));
          flock($fp, LOCK_UN);
          fclose($fp);

          @chmod($this->config_path, FILE_READ_MODE);

          return TRUE;
     }

     // --------------------------------------------------------------------

     /**
     * Update Database Config File
     *
     * Reads the existing DB config file as a string and swaps out
     * any values passed to the function.
     *
     * @access     public
     * @param     array
     * @param     array
     * @return     bool
     */
     function db_config_update($dbconfig = array(), $remove_values = array())
     {
          @chmod($this->database_path, FILE_WRITE_MODE);

          // Is the database file writable?
          if ( ! is_really_writable($this->database_path))
          {
               show_error($this->database_path.' does not appear to have the proper file permissions.  Please make the file writeable.');
          }

          // load the file helper
          $this->CI =& get_instance();
          $this->CI->load->helper('file');

          // Read the config file as PHP
          require $this->database_path;

          // Now we read the file data as a string
          $config_file = read_file($this->database_path);

          if (count($dbconfig) > 0)
          {
               foreach ($dbconfig as $key => $val)
               {

                    $pattern = '/$db[\''.$active_group.'\'][\''.$key.'\']s+=s+[^;]+/';
                   $replace = "$db['$active_group']['$key'] = '$val'";             
                  $config_file = preg_replace($pattern, $replace, $config_file);

               }
          }

          $config_file = trim($config_file);

          // Write the file
          if ( ! $fp = fopen($this->database_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))
          {
               return FALSE;
          }

          flock($fp, LOCK_EX);
          fwrite($fp, $config_file, strlen($config_file));
          flock($fp, LOCK_UN);
          fclose($fp);

          @chmod($this->database_path, FILE_READ_MODE);

          return TRUE;
     }
    
     // --------------------------------------------------------------------

     /**
     * Config status
     *
     * Checks the status of the config files and database connection
     *
     * @access     public
     * @return     array
     */
     function config_status()
     {

          $data['install_warnings'] = array();

          // is PHP version ok?
          if (!is_php('5.1.6'))
          {
               $data['install_warnings'][] = 'php version is too old';
          }

          // is config file writable?
          if (is_really_writable($this->config_path) && ! @chmod($this->config_path, FILE_WRITE_MODE))
          {
               $data['install_warnings'][] = 'config.php file is not writable';
          }

          // Is there a database.php file?
          if (@include($this->database_path))
          {
               if ($this->test_mysql_connection($db[$active_group]))
               {
                    $this->session->set_userdata('user_database_file', TRUE);
               }
               else
               {
                    // Ensure the session isn't remembered from a previous test
                    $this->session->set_userdata('user_database_file', FALSE);

                    @chmod($this->config->database_path, FILE_WRITE_MODE);

                    if (is_really_writable($this->config->database_path) === FALSE)
                    {
                         $vars['install_warnings'][] = 'database file is not writable';
                    }
               }
          }
          else
          {
               $data['install_warnings'][] = 'database config file was not found';
          }

          return $data;
     }    
    
    

}


/* End of file MY_Config.php */
/* Location: application/core/MY_Config.php */

dump SQL
remove install.sql then rename the new one to install.sql

Source

http://misael.org/2012/09/08/self-hosted-applications-installer-for-codeigniter/

https://github.com/misaelzapata/CodeIgniter-Installer/zipball/master

mine – https://skydrive.live.com/redir?resid=F6B936E6BD71BC1%215589