網站網頁的服務中,針對傳輸流量及效率上,會使用快取的機制.
設定某些常用的元件,暫時儲存在使用者的電腦快取中,以增加頁面元件重複使用的速度.
痞客興 發表在 痞客邦 留言(0) 人氣(219)
本文是介紹Nginx的日誌記錄檔存放規則設定,如果你要找日誌記錄檔的格式設定,請參考http://charleslin74.pixnet.net/blog/post/460119008-Nginx%E8%A8%98%E9%8C%84%E6%AA%94%E6%A0%BC%E5%BC%8F%E8%A8%AD%E5%AE%9A%E5%AE%A2%E8%A3%BD%E5%8C%96
接下來進入主題,以上所講的設定,一樣是放在nginx.conf裡面
痞客興 發表在 痞客邦 留言(0) 人氣(4,551)
服務就免不了要記錄,因為記錄可以讓我們觀察服務運行是否正常,也可以進行分析獲得有用的資訊
而Nginx的記錄檔的格式設定一樣也放在nginx.conf裡面,它預設使用combined格式,conbined是格式的名稱.
痞客興 發表在 痞客邦 留言(0) 人氣(1,146)
一台主機上安裝Nginx,如同其他WEB的程式,它也可以同時服務多個站台.
站台可以基於IP或者是域名或是網路埠來進行區分,這些設定一樣是在nginx.conf裡面輸入.
痞客興 發表在 痞客邦 留言(0) 人氣(1,907)
當Nginx執行了一段時間後,可能會有新版本更新,或者因為需求必須加入新的功能模組.
如果你有多台Nginx並且有做分流,那可以一台台主機做更新,不會造成服務的中斷,
痞客興 發表在 痞客邦 留言(0) 人氣(117)
1. 先安裝編譯工具及相依套件
yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
痞客興 發表在 痞客邦 留言(0) 人氣(459)
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install nginx
yum install php-pear-Net-Socket php-pear php-common php-gd php-devel php php-mbstring php-pear-Mail php-cli php-imap php-snmp php-pdo php-xml php-pear-Auth-SASL php-ldap php-pear-Net-SMTP php-mysql
yum install spawn-fcgi
vi /etc/init.d/php_cgi
add content as below
#!/bin/sh
#
# php-cgi - php-fastcgi swaping via spawn-fcgi
#
# chkconfig: - 85 15
# description: Run php-cgi as app server
# processname: php-cgi
# config: /etc/sysconfig/phpfastcgi (defaults RH style)
# pidfile: /var/run/php_cgi.pid
# Note: See how to use this script :
# http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
spawnfcgi="/usr/bin/spawn-fcgi"
php_cgi="/usr/bin/php-cgi"
prog=$(basename $php_cgi)
server_ip=127.0.0.1
server_port=9000
server_user=nginx
server_group=nginx
server_childs=5
pidfile="/var/run/php_cgi.pid"
# do not edit, put changes in /etc/sysconfig/phpfastcgi
[ -f /etc/sysconfig/phpfastcgi ] && . /etc/sysconfig/phpfastcgi
start() {
[ -x $php_cgi ] || exit 1
[ -x $spawnfcgi ] || exit 2
echo -n $"Starting $prog: "
daemon $spawnfcgi -a ${server_ip} -p ${server_port} -u ${server_user} -g ${server_group} -P ${pidfile} -C ${server_childs} -f ${php_cgi}
retval=$?
echo
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} $prog -QUIT
retval=$?
echo
[ -f ${pidfile} ] && /bin/rm -f ${pidfile}
return $retval
}
restart(){
stop
sleep 2
start
}
rh_status(){
status -p ${pidfile} $prog
}
case "$1" in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
rh_status;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 3
esac
chmod +x /etc/init.d/php_cgi
/etc/init.d/php_cgi start
netstat -tulpn | grep :9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 26325/php-cgi
vi /etc/nginx/conf.d/default.conf
add content
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
service nginx restart
痞客興 發表在 痞客邦 留言(0) 人氣(123)