greening install

greening auth install

Amazon Linux AMI 2014.09(Linux xxx 3.14.20-20.44.amzn1.x86_64)
|__ php 5.4
|   \__ pear
|      |__ Mail
|      \__ Net_SMTP
|__ httpd 2.4
|   |__ mod24_ssl
|   \__ /var/www/html/auth.xxx.org
|__ /etc/httpd/conf.d/ssl
|   |__ auth.crt
|   |__ auth.key
|   \__ intermediate.crt
以下部分可與上方分開
\__ postgresql 9.2
    \__ contrib
        |__ uuid-ossp
        |__ adminpack
        \__ xml2

事前準備

  • SSL憑證(auth.crt, auth.key, intermediate.crt)

安裝步驟

  1. 登入主機,轉成root身份操作
    su 或用 sudo yum 或用 sudo su -
    
  2. 安裝php及apache http server
  3. 設定php.ini
    vim /etc/php.ini
    #調整設定
    session.gc_maxlifetime = 14400
    
  4. 安裝postgresql
  5. 初始化資料庫
  6. 安裝程式碼

    • 取得code並設定config資訊

      cd /var/www/html
      
      #安裝git
      yum install git
      
      #自git clone
      git clone xxxxxxxx
      
      #切換至 clone 後的資料夾
      cd xxxxx
      
      #設定postgres db連線資訊
      vim inc/class.DB.php
      
      #設定oauth
      vim inc/class.Constant.php
      
      #設定寄信者
      vim default/sendactivatemail.php
      vim default/sendpwdresetmail.php
      
      if(!isset($username))
        $username = "[email protected]";
      if(!isset($password))
        $password = "xxx";
      
    • 設定apache

      vim /etc/httpd/conf/httpd.conf
      DocumentRoot "/var/www/html/auth.xxxx.org/"
      #移除目錄索引(Indexes)
      #修改前:
      Options Indexes FollowSymLinks
      #修改後:
      Options FollowSymLinks
      
      #新增設定api資料夾
      <Directory "/var/www/html/auth.xxxx.org/1campus/manage/api">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
      </Directory>
      
      #設定default page
      #找不到 <IfModule dir_module> 時修改 DirectoryIndex 即可
      <IfModule dir_module>
        DirectoryIndex default.php index.php index.html
      </IfModule>
      
    • 用php pear安裝Mail & Net_SMTP
      yum install php-pear
      pear install Mail
      pear install Net_SMTP