顯示具有 Apache2 標籤的文章。 顯示所有文章
顯示具有 Apache2 標籤的文章。 顯示所有文章

2015年2月12日 星期四

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/

2015年2月11日 星期三

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 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/