2015年12月18日 星期五

Swift 2 Xcode7.1 Facebook SDK + 自訂Facebook Button

一、下載Facebook SDK
二、Xcode開新專案
編輯專案下的info.plist
新增以下設定
Facebook developer key 記得先去申請 Facebook Developer
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string> 
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>facebook.com</key>
    <dict>
      <key>NSIncludesSubdomains</key> <true/>        
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
    </dict>
    <key>fbcdn.net</key>
    <dict>
      <key>NSIncludesSubdomains</key> <true/>
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>  <false/>
    </dict>
    <key>akamaihd.net</key>
    <dict>
      <key>NSIncludesSubdomains</key> <true/>
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
    </dict>
  </dict>
</dict>


三、將.framework檔放入
先new Group,名稱為Frameworks
在將FBSDKCoreKit.framework,FBSDKLoginKit.framework,FBSDKShareKit.framework放入Frameworks裡

四、寫程式
1.AppDelegate.swift

import UIKit
import CoreData
import FBSDKCoreKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication,
        openURL url: NSURL,
        sourceApplication: String?,
        annotation: AnyObject) -> Bool {
            return FBSDKApplicationDelegate.sharedInstance().application(
                application,
                openURL: url,
                sourceApplication: sourceApplication,
                annotation: annotation)
    }
.....
}
2.ViewController.swift

import UIKit
import FBSDKCoreKit
import FBSDKShareKit
import FBSDKLoginKit

class ViewController: UIViewController {
    let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    @IBAction func loginAction(sender: AnyObject) {
        
        fbLoginManager.logInWithReadPermissions(["email"],fromViewController: self.parentViewController, handler: { (result, error) -> Void in
            if (error == nil){
                let fbloginresult : FBSDKLoginManagerLoginResult = result
                if(fbloginresult.grantedPermissions.contains("email"))
                {
                    self.getFBUserData()
                    self.fbLoginManager.logOut()
                }
            }
        })
        
    }
    func getFBUserData(){
        if((FBSDKAccessToken.currentAccessToken()) != nil){
            FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email"]).startWithCompletionHandler({ (connection, result, error) -> Void in
                if (error == nil){
                    print(result)
                }
            })
        }
    }
    @IBAction func logoutAction(sender: AnyObject) {
        
        fbLoginManager.logOut()
    }
    
}


打完收功...

2015年12月17日 星期四

Swift 2 Xcode7.1 Google Map SDK example

前提:
來抱怨一下,相信大家也是這樣,只要Xcode版本一大改,很多套件都需要更新
以前我是用下載他的sdk裡面的framework檔放進去,但是現在用cocoapods來處理
本篇是用Swift2.0所開發,Object-C的話... 我不會

一、開始Terminal

安裝cocoapods
sudo gem install cocoapods

二、開新專案
開新增案後,在將專案關閉
專案名稱:TestMap
到專案目錄下,新增Podfile檔
以下是內容,編輯完後儲存
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'

在用Terminal cd到專案目錄
cd ........./TestMap

在用Terminal,執行以下的指令
pod install

四、取得Google Developer Console Key
點此連結申請

五、最後寫程式
請打開TestMap.xcworkspace
1.AppDelegate.swift
...
import GoogleMaps

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        GMSServices.provideAPIKey("key")
        return true
    }
...
}

2.ViewController.swift
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let camera = GMSCameraPosition.cameraWithLatitude(-33.86,
            longitude: 151.20, zoom: 6)
        let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
        mapView.myLocationEnabled = true
        self.view = mapView
        
        let marker = GMSMarker()
        marker.position = CLLocationCoordinate2DMake(-33.86, 151.20)
        marker.title = "Sydney"
        marker.snippet = "Australia"
        marker.map = mapView
    }


}

3.Run... Finish

參考鏈結:
https://developers.google.com/maps/documentation/ios-sdk/start/
https://www.youtube.com/watch?v=q6tg3gl7CsU

2015年2月18日 星期三

How to install iRedMail 9.0 on ubunt14.10 and receive email.

軟體準備

一、安裝前的準備
sudo apt-get update

二、iRedMail安裝及設定
hostname -f

這邊只有顯示你主機名稱,請在加上你的domain name,不然不能裝iRedMail

以下是修改hosts,紅線的地方加上你要設定的domain name:
sudo vim /etc/hosts
hostname -f

下載iRedMain 9.0及安裝:
sudo wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.0.tar.bz2
sudo tar jxvf iRedMail-0.9.0.tar.bz2
cd iRedMail-0.9.0
sudo bash iRedMail.sh
以下的設定依照紅色的部分做設定:
















這邊我對apache比較熟所以我選擇apache:
















設定LDAP密碼:
















設定MySQL密碼:
















設定Virtual domain name:
















設定admin密碼:



































































sudo reboot
有兩個網址
一、https://ip/mail/
二、https://ip/iredadmin
用postmaster@city-get.com登入,密碼在你安裝時所設定的。
忘記密碼請下以下的指令就可以查詢到。

more iRedMail-0.9.0/iRedMail.tips
請自行把DNS 記錄管理與設定好,以下是我台灣固網的設定方式。















這時測試,會發生一個問題你會遇到可以寄信,但不能收信
請設定以下的設定。
sudo vim /etc/cluebringer/cluebringer.conf
內容如下,將enable=1改0,修改完後儲存:
...
# Greylisting module
[Greylisting]
enable=0 
...
sudo  /etc/init.d/postfix-cluebringer restart



備註:我這邊有遇到漏信的問題,是當我server重開時,server剛啟動時,這時收信都收不到,所以這邊請耐心等10~20分(大概還有東西在啟動)。

參考鏈結:
http://www.unixmen.com/setup-mail-server-in-minutes-using-iredmail-in-ubuntu-12-10-debian-6/
http://lordcail.blogspot.tw/2013/10/solved-iredmailroundcube-cant-receive.html

2015年2月12日 星期四

Ubuntu 掃木馬程式 chkrootkit + rkhunter

一、下載
sudo apt-get install chkrootkit
sudo apt-get install rkhunter

二、更新與掃描
sudo chkrootkit
sudo rkhunter –check
sudo rkhunter --update


參考鏈結:http://www.arthurtoday.com/2012/01/ubuntu-rootkit-scanner.html

Logcheck on ubuntu14.10

一、Logcheck 安裝
sudo apt-get install logcheck
設定要把log寄到你的信箱
sudo vim /etc/logcheck/logcheck.conf
內容修改:
...
SENDMAILTO="xxxxxx@gmail.com"
...
測試是否可以把log寄到信箱
sudo -u logcheck logcheck

二、msmtp 安裝
sudo apt-get install msmtp
將msmtp 寄件者改成gmail,內容如下:
sudo vim /etc/msmtprc
account gmail
account default: gmail
host smtp.gmail.com
from xxxxxx@gmail.com
protocol smtp
tls on
auth on
port 587
user xxxxxx@gmail.com
password xxooxx
logfile /var/log/msmtp.log
tls_starttls on
tls_certcheck off
測試msmtp寄mail
echo "Test from msmtp" | msmtp xxxxxx@gmail.com
將logcheck寄信功能改成msmtp來寄
sudo ln -s /usr/bin/msmtp /usr/local/sbin/sendmail
sudo ln -s /usr/bin/msmtp /usr/local/bin/sendmail
測試是否可以寄信
echo -e "Subject: I hope I receive this\nTest from sendmail" | sendmail xxxxxx@gmail.com


參考鍵結:http://nixnote.blogspot.tw/2013/10/configuring-logcheck-on-ubuntu.html

Apache2.4 + multi Tomcat8 + mod_jk(binary) on ubuntu14.10

Apache2.4安裝教學Tomcat8安裝教學

軟體準備

一、下載及安裝
sudo wget http://apache.stu.edu.tw/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz
sudo tar xvzf tomcat-connectors-1.2.40-src.tar.gz
cd tomcat-connectors-1.2.40-src/native
sudo ./buildconf.sh
sudo ./configure --with-apxs=/usr/local/apache2/bin/apxs
sudo make
sudo make install
查看 /usr/local/apache2/modules/ 是否有mod_jk.so
ls -al /usr/local/apache2/modules/

二、mod_jk與Apache2設定
sudo vim /usr/local/apache2/conf/workers.properties
內容新增如下:
worker.list=DLOG4J,DLOG4J1, status
worker.DLOG4J.type=lb
worker.DLOG4J.sticky_session=1
worker.DLOG4J.error_escalation_time=0
worker.DLOG4J.max_reply_timeouts=10
worker.DLOG4J1.type=lb
worker.DLOG4J1.sticky_session=1
worker.DLOG4J1.error_escalation_time=0
worker.DLOG4J1.max_reply_timeouts=10

worker.s1.reference=worker.template
worker.s1.port=8009
worker.s1.host=localhost
worker.s1.lbfactor=5
worker.s2.reference=worker.template
worker.s2.port=8010
worker.s2.host=localhost
worker.s2.lbfactor=5

worker.template.type=ajp13                    
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3

worker.retries=3
worker.DLOG4J.balanced_workers= s1
worker.DLOG4J1.balanced_workers= s2

worker.status.type=status
worker.s1.port=8009 這一個port請看你tomcat/conf/server.xml的AJP port
sudo vim /usr/local/apache2/conf/httpd.conf
內容新增如下:
...
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so

#這邊新增
LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile     /var/log/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /private/admin/status status
JkMount /test/* DLOG4J
JkMount /test1/* DLOG4J1
請在tomcat webapps裡面新增test資料夾,在寫一支index.jsp,看是否用80 port可不可以進來。

參考鏈結: http://www.altj.com/setup-mod_jk-on-ubuntu-dapper-for-ofbiz/

How to install multi Tomcat8 binary on ubuntu14.10(64Bit)

軟體準備
前提:事先把JDK環境安裝完成。

一、下載及設定路徑
sudo cd /usr/local/tomcat
sudo wget http://apache.stu.edu.tw/tomcat/tomcat-8/v8.0.18/bin/apache-tomcat-8.0.18.tar.gz
sudo tar xzvf apache-tomcat-8.0.18.tar.gz
sudo cp ./apache-tomcat-8.0.18 /usr/local/tomcat/apache-tomcat-8.0.18-1
sudo cp ./apache-tomcat-8.0.18 /usr/local/tomcat/apache-tomcat-8.0.18-2

二、新增Tomcat的使用者
sudo useradd -s /sbin/nologin -d /opt/tomcat/temp tomcat
 cd /usr/local/tomcat

三、啟動/停止Tomcat

啟動
cd /usr/local/tomcat/apache-tomcat-8.0.18-1/bin
sudo ./startup.sh
sudo ./catalina.sh run
sudo ./catalina.sh start
停止
sudo ./shutdown.sh
sudo ./catalina.sh stop

四、安裝Tomcat服務
sudo vim /etc/init.d/tomcat8-1
內容新增如下:
#!/bin/bash
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.0.18-1
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
 sh $CATALINA_HOME/bin/startup.sh
}
stop() {
 sh $CATALINA_HOME/bin/shutdown.sh
}
case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 "; exit 1;;
esac
儲存後,離開。
sudo chmod 755 /etc/init.d/tomcat8-1
sudo service tomcat8-1 start
sudo /etc/init.d/tomcat8-1 start
sudo service tomcat8-1 stop
sudo /etc/init.d/tomcat8-1 stop
sudo update-rc.d tomcat8-1 defaults
一個Tomcat的服務就安裝完成。

五、多個Tomcat設定
sudo vim /usr/local/tomcat/apache-tomcat-8.0.18-2/conf/server.xml
內容如下:
...
<Server port="8005" shutdown="SHUTDOWN">
...
...
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
...
...
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
...
...
將 8005、8080、8009的port改沒有使用過的port,在從剛剛的第三個步驟開始設定。


參考鏈結:http://www.ntu.edu.sg/home/ehchua/programming/howto/Ubuntu_HowTo.html#tomcat

2015年2月11日 星期三

PHP.ini 設定 MySQL

一、先安裝autoconf
sudo apt-get install autoconf

二、安裝PHP裡mysql套件
cd php-5.5.15/ext/mysql
sudo phpize
sudo ./configure --enable-mysql
sudo make
sudo make test
sudo make install

三、安裝PHP裡mysqli套件
cd ../mysqli
sudo phpize
sudo ./configure --enable-mysqli
sudo make
sudo make test
sudo make install

四、安裝PHP裡pdo_mysql套件
cd ../pdo_mysql
sudo phpize
sudo ./configure --enable-pdo_mysql
sudo make
sudo make test
sudo make install

四、php.ini設定
修改底下把;拿掉
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=mysql.so
extension=mysqli.so
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=pdo_mysql.so
重啟Apache2 server
sudo service apache2 restart

How to install MySQL5.6 binary on ubuntu14.10(64Bit)

軟體準備
  • mysql-5.6.19.tar.gz

一、MySQL下載及安裝
sudo wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz
sudo gzip -d mysql-5.6.19.tar.gz
sudo tar xvf mysql-5.6.19.tar
sudo groupadd mysql
sudo useradd -g mysql mysql
cd mysql-5.6.19
sudo cmake -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/var/tmp/mysql.sock -DSYSCONFDIR=/etc .
sudo make
sudo make install

二、權限修改或設定
cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo scripts/mysql_install_db --user=mysql

三、設定MySQL啟動時間
sudo su mysql
./bin/mysqld_safe start
cd /usr/local/mysql
sudo chown -R root .
sudo chown -R mysql data
sudo cp support-files/mysql.server /etc/init.d/mysql.server
sudo /etc/init.d/mysql.server start
sudo update-rc.d mysql.server defaults
sudo ln -s /usr/local/mysql/bin/* /usr/local/bin/
sudo mysql_secure_installation


參考鏈結:https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/

How to install PHP5 binary on ubuntu14.10

軟體準備
  • php-5.5.15.tar.gz

一、下載及安裝
sudo wget http://us1.php.net/distributions/php-5.5.15.tar.gz
sudo gzip -d php-5.5.15.tar.gz
sudo tar xvf php-5.5.15.tar
cd php-5.5.15
sudo ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-gd --with-mhash --with-mcrypt --with-curl --with-openssl --with-zlib --with-jpeg-dir --with-png-dir --with-pcre-regex --enable-calendar --enable-exif --enable-ftp --enable-mbstring --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip
sudo make
sudo make test
sudo make install
cp php.ini-development /usr/local/lib/php.ini
sudo mkdir java

二、與Apache2整合
sudo vim /usr/local/apache2/conf/httpd.conf
請先找到的訊息:
#LoadModule php5_module        modules/libphp5.so
註解拿掉:
LoadModule php5_module        modules/libphp5.so
在最底下新增以下的訊息:
<filesmatch \.php$="">
    SetHandler application/x-httpd-php
</filesmatch>
AddType application/x-httpd-php .php .html .htm
AddHandler php5-script  .php  
儲存後,離開。
重啟Apache2 server
sudo service apache2 restart

三、測試PHP
sudo vim /usr/local/apache2/htdocs/info.php
內容為底下:
<?php
 phpinfo();
?>
測試鏈結以下:
http://127.0.0.1/info.php  


參考鍵結:
https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/
http://www.rootusers.com/installing-apache-2-4-and-php-5-4-from-source/

How to install JDK8 binary on ubuntu14.10(64Bit)

軟體準備

一、準備要放JDK的路徑
cd /usr/local
sudo mkdir java

二、將檔案解壓縮
cd /usr/local/java
sudo tar xzvf ~/Downloads/jdk-8u31-linux-x64.tar.gz

三、Ubuntu更新JDK8安裝位置
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_31/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_31/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_31/jre/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jdk1.8.0_31/jre/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_31/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_31/jre/bin/javaws

查看路徑是否設定成功
cd /usr/bin
ls -ld java*
以下訊息:
lrwxrwxrwx 1 root root 22 Mar 31 20:41 java -> /etc/alternatives/java
lrwxrwxrwx 1 root root 23 Mar 31 20:42 javac -> /etc/alternatives/javac
lrwxrwxrwx 1 root root 24 Mar 31 20:42 javaws -> /etc/alternatives/javaws
cd /etc/alternatives
ls -ld java*
以下訊息:
lrwxrwxrwx 1 root root 40 Aug 29 18:18 java -> /usr/local/java/jdk1.8.0_20/jre/bin/java
lrwxrwxrwx 1 root root 37 Aug 29 18:18 javac -> /usr/local/java/jdk1.8.0_20/bin/javac
lrwxrwxrwx 1 root root 42 Aug 29 18:19 javaws -> /usr/local/java/jdk1.8.0_20/jre/bin/javaws

查看java版本與路徑
javac -version
java -version
which javac
which java

四、設定JAVA PATH跟JAVA HOME
cd /etc
sudo vim profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_31
export PATH=$JAVA_HOME/bin:$PATH
儲存後離開
source /etc/profile
echo $JAVA_HOME
echo $PATH


參考鍵結:https://www3.ntu.edu.sg/home/ehchua/programming/howto/Ubuntu_HowTo.html#jdk

How to install Apache2.4 binary on ubuntu14.10(64Bit)

軟體準備
  • pcre-8.35.tar.gz
  • httpd-2.4.10.tar.gz
  • apr-1.5.1.tar.gz
  • apr-util-1.5.3.tar.gz

更新Ubuntu套件與安裝所需套件
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gcc make cmake libssl-dev libxml2-dev libpng-dev libjpeg-dev libcurl4-openssl-dev libbz2-dev libncurses5 libncurses5-dev libaio1 libmcrypt-dev

一、Pcre下載及安裝
sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
sudo gzip -d pcre-8.35.tar.gz
sudo tar xvf pcre-8.35.tar
cd pcre-8.35
sudo ./configure
sudo make
sudo make install

二、Apache2.4 + Apr + Apr-util 下載及安裝
sudo wget http://archive.apache.org/dist/httpd/httpd-2.4.10.tar.gz
sudo gzip -d httpd-2.4.10.tar.gz
sudo tar xvf httpd-2.4.10.tar
sudo wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
sudo gzip -d apr-1.5.1.tar.gz
sudo tar xvf apr-1.5.1.tar
sudo wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz
sudo gzip -d apr-util-1.5.3.tar.gz
sudo tar xvf apr-util-1.5.3.tar
sudo mv apr-1.5.1 apr
sudo mv apr-util-1.5.3 apr-util
sudo mv apr apr-util httpd-2.4.10/srclib/
cd httpd-2.4.10
sudo ./configure --with-included-apr --with-pcre=/usr/local/bin/pcre-config --with-crypto --enable-ssl --enable-rewrite --enable-dav --enable-so --enable-http --enable-mime-magic --enable-info
sudo make
sudo make install

sudo /usr/local/apache2/bin/apachectl start
#Start Apache2 Server-會發生以下的錯誤

/usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

解決 Start Apache2 server 方法如下
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
sudo ldconfig
sudo /usr/local/apache2/bin/apachectl restart

三、設定Apache2啟動時間(Start Apache at Boot Time)
sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apache2
sudo chmod +x /etc/init.d/apache2
sudo update-rc.d apache2 defaults

四、增加Apache2 程式執行路徑
export PATH=$PATH:/usr/local/apache2/bin

五、設定Apache2路徑權限
sudo chown -R root:root /usr/local/apache2/
sudo chmod -R go-rwx /usr/local/apache2/
sudo chmod -R a-w /usr/local/apache2/
sudo chmod o+x /usr/local/apache2/
sudo chmod o+x /usr/local/apache2/htdocs/
sudo chmod o+x /usr/local/apache2/cgi-bin/
sudo chmod -R o+r /usr/local/apache2/htdocs/
sudo chmod -R u+w /usr/local/apache2/conf/ /usr/local/apache2/logs/


參考鏈結:https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/