This document summarizes the use of Nginx as a web server and load balancer in internet development. It discusses Nginx's high performance and low resource usage. Key points covered include installing and configuring Nginx, using it for load balancing, and integrating it with other technologies.
The document contains CSS styles for common elements like buttons, links, tables, forms and text boxes. It includes styles for different types of buttons like blue, red, green buttons. It also contains styles for tables, dropdowns, text boxes, progress bars and calendars. The styles define properties for fonts, colors, borders, backgrounds etc.
The document is a reference guide for Unix/Linux commands and tasks useful for system administration and advanced users. It contains over 20 sections covering topics like the system, processes, file system, networking, encryption, version control and programming. Each section provides concise explanations of relevant commands and how to perform common tasks in that area. The reader is expected to have a working knowledge of the Unix environment.
Uso de la Programación para la Seguridad en Redes (a.k.a. Sockets y Shellcoding)Pedro Valera
Conferencia dictada en la Pontificia Universidad Católica del Perú (PUCP) para el Linux Week 2010.
Más info:
http://linux.pucp.edu.pe/etiquetas/linux-week-2010
"Seguridad en Servicios Web" exposición del Ing. Saul Mamani Mamani, desarrollada en el III Congreso Internacional de Informática Forense y Hacking Ético, desarrollado en la ciudad de Tarija en Bolivia el Sábado 03 de Mayo del 2014
A Picture of Cassandra in the Real World - StampedeCon 2014StampedeCon
At StampedeCon 2014, Nate McCall (The Last Pickle) presented "A Picture of Cassandra in the Real World."
In this presentation, we’ll look past the media and marketing hype surrounding Cassandra to provide useful information taken directly from a number of real world use cases.
We’ll discuss:
systems architectures and methods of deployment
performance characteristics of common workloads
operations tasks required for keeping clusters healthy
solutions to backup and recovery
how to fit Cassandra into common software development processes
Presented by a long-time Cassandra user and community member who led the development of the original Java driver back in the fall of 2009, this talk will be thorough, accurate, and informative. Attendees will come away with a better understanding of how to best leverage the power and operational characteristics of Cassandra in their architectures.
This document summarizes the use of Nginx as a web server and load balancer in internet development. It discusses Nginx's high performance and low resource usage. Key points covered include installing and configuring Nginx, using it for load balancing, and integrating it with other technologies.
The document contains CSS styles for common elements like buttons, links, tables, forms and text boxes. It includes styles for different types of buttons like blue, red, green buttons. It also contains styles for tables, dropdowns, text boxes, progress bars and calendars. The styles define properties for fonts, colors, borders, backgrounds etc.
The document is a reference guide for Unix/Linux commands and tasks useful for system administration and advanced users. It contains over 20 sections covering topics like the system, processes, file system, networking, encryption, version control and programming. Each section provides concise explanations of relevant commands and how to perform common tasks in that area. The reader is expected to have a working knowledge of the Unix environment.
Uso de la Programación para la Seguridad en Redes (a.k.a. Sockets y Shellcoding)Pedro Valera
Conferencia dictada en la Pontificia Universidad Católica del Perú (PUCP) para el Linux Week 2010.
Más info:
http://linux.pucp.edu.pe/etiquetas/linux-week-2010
"Seguridad en Servicios Web" exposición del Ing. Saul Mamani Mamani, desarrollada en el III Congreso Internacional de Informática Forense y Hacking Ético, desarrollado en la ciudad de Tarija en Bolivia el Sábado 03 de Mayo del 2014
A Picture of Cassandra in the Real World - StampedeCon 2014StampedeCon
At StampedeCon 2014, Nate McCall (The Last Pickle) presented "A Picture of Cassandra in the Real World."
In this presentation, we’ll look past the media and marketing hype surrounding Cassandra to provide useful information taken directly from a number of real world use cases.
We’ll discuss:
systems architectures and methods of deployment
performance characteristics of common workloads
operations tasks required for keeping clusters healthy
solutions to backup and recovery
how to fit Cassandra into common software development processes
Presented by a long-time Cassandra user and community member who led the development of the original Java driver back in the fall of 2009, this talk will be thorough, accurate, and informative. Attendees will come away with a better understanding of how to best leverage the power and operational characteristics of Cassandra in their architectures.
Installation of Subversion on Ubuntu,...wensheng wei
The document provides instructions for installing Subversion on Ubuntu with Apache, SSL, and BasicAuth to allow hosting SVN repositories on a web server, including installing necessary packages, configuring Apache with a SSL certificate and virtual host, creating repositories under /var/svn, setting up authentication using htpasswd, and enabling WebDAV and SVN support in Apache.
Happiness is a journey, not a destination. The document discusses how people often tell themselves they will be happy once they achieve certain life goals or milestones, like getting married, having children, or retiring. However, challenges will always remain. True happiness is about finding contentment in the present moment and not waiting for the future to enjoy life. We must embrace each day as it comes and appreciate the time we have.
This document provides shortcuts and commands for Linux. It begins with essential shortcuts for switching between terminals and GUI screens. It then provides summaries of commands for getting system information, basic file operations, and networking. Examples are given for most commands.
This document provides a quick reference guide for Linux security that includes definitions of common security terms, general security tips, and Linux security resources. It defines terms like buffer overflow, cryptography, denial of service, and port scanning. It offers tips such as using automatic package managers to update software, configuring firewalls and intrusion detection, and enforcing strong password policies. The document also lists various security-related websites, books, and open source tools that can aid in hardening Linux systems.
The document describes a podcast called "Ubuntu UK Podcast" which is produced by members of the Ubuntu Linux community in the United Kingdom. The podcast aims to provide current information about Ubuntu Linux and free software to users around the world, covering all aspects from the command line to the latest GUI. As it is produced by the Ubuntu UK community, the podcast follows the Ubuntu Code of Conduct and is suitable for all ages.
This document provides a summary of common commands and configuration files used in Ubuntu systems for privileges, networking, display, package management, applications, services, and system recovery. It includes commands for sudo access, configuring networking and wireless settings, starting and stopping services, installing and removing packages, checking the system version, and rebooting the system through keyboard shortcuts. Configuration files like /etc/network/interfaces and /etc/X11/xorg.conf are also listed.
3. 快速安装笔记[ 原创]
通过Nginx使全站页面变灰,
一、 获 取相 关开 源程序:
一、
哀悼玉树地震遇难者
1 、【适用CentOS 操作系统】利用CentOS Linux系统自带的yum命令安装、升级所需的程序库(RedHat 等其他Linux发行版可从安装光盘
金山逍遥网 sersync 服务器 中找到这些程序库的RPM包,进行安装):
实时镜像、自动同步程序开源
Tokyo Cabinet Key-Value 数 sudo -s
据库及其扩展应用PPT[ 原创] LANG=C
《实战Nginx:取代Apache 的 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib
高性能Web 服务器》已出版发行 zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel
轻量级开源简单队列服务
krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
HTTPSQS 1.2 版本发布[ 原创]
Nginx 0.8.x + PHP
5.2.13 (FastCGI)搭建胜 2 、【适用RedHat 操作系统】RedHat 等其他Linux发行版可从安装光盘中找到这些程序库的RPM包(事先可通过类似“rpm -qa | grep
过Apache 十倍的Web 服务器(第
libjpeg”的命令查看所需的RPM包是否存在,通常是“xxx-devel”不存在,需要安装)。RedHat 可以直接利用CentOS 的RPM包安装,以下
是RPM包下载网址:
6 版)[ 原创] ①、RedHat AS4 & CentOS 4
http://mirrors.163.com/centos/4/os/i386/CentOS/RPMS/
最新 评论 http://mirrors.163.com/centos/4/os/x86_64/CentOS/RPMS/
在xp 下提示这个是因为没...
②、RedHat AS5 & CentOS 5
厉害,学习了
http://mirrors.163.com/centos/5/os/i386/CentOS/
不怎么明白 http://mirrors.163.com/centos/5/os/x86_64/CentOS/
没太明白。请问,这个适用...
可不可以把源码发给我 ③、RPM包搜索网站
一份... http://rpm.pbone.net/
你好张宴~我今天使用 http://w w w .rpmfind.net/
页面...
很好, 谢谢!......... ④、RedHat AS4 系统环境,通常情况下缺少的支持包安装:
能不能在G1 上装一个PH... Ⅰ、i386 系统
请问我是在ubuntu ...
w get http://blog.s135.com/soft/linux/nginx_php/rpm/i386/libjpeg-devel-6b-33.i386.rpm
张老师,您好。为什么我配... rpm -ivh libjpeg-devel-6b-33.i386.rpm
w get http://blog.s135.com/soft/linux/nginx_php/rpm/i386/freetype-devel-2.1.9-1.i386.rpm
新浪微博 rpm -ivh freetype-devel-2.1.9-1.i386.rpm
w get http://blog.s135.com/soft/linux/nginx_php/rpm/i386/libpng-devel-1.2.7-1.i386.rpm
rpm -ivh libpng-devel-1.2.7-1.i386.rpm
张宴
粉丝1071 人 Ⅱ、x86_64 系统
w get http://blog.s135.com/soft/linux/nginx_php/rpm/x86_64/libjpeg-devel-6b-33.x86_64.rpm
rpm -ivh libjpeg-devel-6b-33.x86_64.rpm
上午前往旅顺,参观了日俄战争遗址、旅顺口军港、蛇乐园、清代海防炮台。
w get http://blog.s135.com/soft/linux/nginx_php/rpm/x86_64/freetype-devel-2.1.9-1.x86_64.rpm
8 月7 日 14:56 rpm -ivh freetype-devel-2.1.9-1.x86_64.rpm
w get http://blog.s135.com/soft/linux/nginx_php/rpm/x86_64/libpng-devel-1.2.7-1.x86_64.rpm
火车快到大连了,起床。我在这里 rpm -ivh libpng-devel-1.2.7-1.x86_64.rpm
8 月7 日 06:47
3 、【适用CentOS 、RedHat 及其它Linux操作系统】下载程序源码包:
昨天用adb 为G1 手机刷Recovery+SPL,将Recovery刷坏了,进不去。后来在Android 市场找名为“rom manager” 的APK程序,安装后,刷了Recovery 1.7.0 ,修复了刷坏的R
本文中提到的所有开源软件为截止到2010 年07 月26 日的最新稳定版。
ecovery,再刷SPL,一切顺利。 ①、从软件的官方网站下载:
8 月6 日 09:37
mkdir -p /data0/softw are
cd /data0/softw are
w get http://sysoev.ru/nginx/nginx-0.8.46.tar.gz
部门组织旅游,今天下班后,前往大连,周二回北京。
8 月6 日 09:12 w get http://w w w .php.net/get/php-5.2.14.tar.gz/from/this/mirror
w get http://php-fpm.org/dow nloads/php-5.2.14-fpm-0.5.14.diff.gz
w get http://dev.mysql.com/get/Dow nloads/MySQL-5.5/mysql-5.5.3-m3.tar.gz/from/http://mysql.he.net/
今天,汇了10 万港元到我在香港大福证券的股票账户。
w get http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
7 月30 日 23:58 w get "http://dow nloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0"
w get "http://dow nloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0"
w get http://pecl.php.net/get/memcache-2.2.5.tgz
今天下午费了半天劲查找关于“HTTP get "http://dow nloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"
w POST”的一个问题,后来发现跟 HTTP 协议中的“Expect: 100-continue”有关,明天写篇文章详细描述一下。
7 月29 日 19:41 w get ftp://ftp.csx.cam.ac.uk/pub/softw are/programming/pcre/pcre-8.10.tar.gz
w get http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
博客音 乐
w get http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
w get http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
w get http://pecl.php.net/get/imagick-2.3.0.tgz
②、从blog.s135.com下载(比较稳定,只允许在本站,或者在Linux/Unix下通过W get 、Curl等命令下载以下软件):
mkdir -p /data0/softw are
cd /data0/softw are
w get http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.8.46.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.14.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.14-fpm-0.5.14.diff.gz
w get http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.3-m3.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.1.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz
w get http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-8.10.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.6.1.tar.bz2
w get http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz
w get http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
w get http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.3.0.tgz
二、安装 PHP 5.2.14( FastCGI模式)
二、安装
1 、编译安装PHP 5.2.14 所需的支持库:
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
我的豆瓣 make install
cd ../
converted by Web2PDFConvert.com
4. cd ../
我看过的书/ 电影
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
我在看的书/ 电影 ./configure --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
我想看的书/ 电影 make
make install
cd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
我的豆瓣主页 ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
链接
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
-----图 片 链 接 ----- ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
-----合作机构 -----
武汉博文视点官方博客
W EB编程站 2 、编译安装MySQL 5.5.3-m3
-----IT界好友 ----- /usr/sbin/groupadd mysql
[ 金山] 李安科 /usr/sbin/useradd -g mysql mysql
[ 金山] 蔡恩雷 tar zxvf mysql-5.5.3-m3.tar.gz
[ 金山] 王绘敏 cd mysql-5.5.3-m3/
[ 新浪] W irlfly ./configure --prefix=/usr/local/w ebserver/mysql/ --enable-assembler --w ith-extra-charsets=complex --enable-thread-safe-client -
[ 新浪] JiangYuan -w ith-big-tables --w ith-readline --w ith-ssl --w ith-embedded-server --enable-local-infile --w ith-
[ 新浪] 超群 plugins=partition,innobase,myisammrg
[ 腾讯] muyannian make && make install
[ 支付宝] 冯大辉 chmod +w /usr/local/w ebserver/mysql
[ 天涯] 醉清风的叶子 chow n -R mysql:mysql /usr/local/w ebserver/mysql
[ 博客大巴] 车东 cd ../
[ 百度] 石展,DBA 的视界
[ 中国雅虎] cc0cc
[ 一地带] 扶凯
yanw einet 附:以下为附加步骤,如果你想在这台服务器上运行MySQL数据库,则执行以下几步。如果你只是希望让PHP 支持MySQL扩展库,能够
连接其他服务器上的MySQL数据库,那么,以下两步无需执行。
Let's gotolab
阿熊的窝 ①、创建MySQL数据库存放目录
戴昌二
蓝风网络日志 mkdir -p /data0/mysql/3306/data/
Linuxs's Blog mkdir -p /data0/mysql/3306/binlog/
LinYH's Blog mkdir -p /data0/mysql/3306/relaylog/
Licess's Blog chow n -R mysql:mysql /data0/mysql/
怒放的生命
Show jay's Blog
怪鸟博客 ②、以mysql用户帐号的身份建立数据表:
怡水若寒 /usr/local/w ebserver/mysql/bin/mysql_install_db --basedir=/usr/local/w ebserver/mysql --datadir=/data0/mysql/3306/data --
funy's Blog user=mysql
王先进
空城's blog
gmle ③、创建my.cnf配置文件:
Python 中国
空城's blog vi /data0/mysql/3306/my.cnf
海天旭日的blog
叶茂盛 输入以下内容:
杨言的博客
Selboo' Blog 引用
OOPHP
PTUbuntu Blog [client]
搜我收藏 character-set-server = utf8
外来者设计工室 port = 3306
f0rest socket = /tmp/mysql.sock
我的技术生活-王炜
Jason Yu [mysqld]
梦昙花开 character-set-server = utf8
replicate-ignore-db = mysql
jean replicate-ignore-db = test
sunlick's replicate-ignore-db = information_schema
badb0y's Blog user = mysql
Yustar's Blog port = 3306
Jvones' blog socket = /tmp/mysql.sock
怪鸟网络日志 basedir = /usr/local/w ebserver/mysql
Martin
converted by Web2PDFConvert.com
6. 评论数量 5999
引用数量 6 function_stop_mysql()
{
留言数量 971 printf "Stoping MySQL...n"
注册用户 890 /usr/local/w ebserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_passw ord} -S /tmp/mysql.sock shutdow n
在线人数 109 }
其他 function_restart_mysql()
登入
{
printf "Restarting MySQL...n"
注册 function_stop_mysql
申请链接 sleep 5
RSS : 日志 | 评论 function_start_mysql
编码:UTF-8 }
XHTML 1.0
function_kill_mysql()
{
kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | aw k '{printf $2}')
kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | aw k '{printf $2}')
}
if [ "$1" = "start" ]; then
function_start_mysql
elif [ "$1" = "stop" ]; then
function_stop_mysql
elif [ "$1" = "restart" ]; then
function_restart_mysql
elif [ "$1" = "kill" ]; then
function_kill_mysql
else
printf "Usage: /data0/mysql/${mysql_port}/mysql {start|stop|restart|kill}n"
fi
⑤、赋予shell脚本可执行权限:
chmod +x /data0/mysql/3306/mysql
⑥、启动MySQL:
/data0/mysql/3306/mysql start
⑦、通过命令行登录管理MySQL服务器(提示输入密码时直接回车):
/usr/local/w ebserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
⑧、输入以下SQL语句,创建一个具有root 权限的用户(admin )和密码(12345678 ):
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '12345678';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '12345678';
⑨、(可选)停止MySQL:
/data0/mysql/3306/mysql stop
3 、编译安装PHP (FastCGI模式)
tar zxvf php-5.2.14.tar.gz
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
cd php-5.2.14/
./configure --prefix=/usr/local/w ebserver/php --w ith-config-file-path=/usr/local/w ebserver/php/etc --w ith-
mysql=/usr/local/w ebserver/mysql --w ith-mysqli=/usr/local/w ebserver/mysql/bin/mysql_config --w ith-iconv-dir=/usr/local --w ith-
freetype-dir --w ith-jpeg-dir --w ith-png-dir --w ith-zlib --w ith-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --
enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --w ith-curl --w ith-curlw rappers
--enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --w ith-mcrypt --w ith-gd --enable-
gd-native-ttf --w ith-openssl --w ith-mhash --enable-pcntl --enable-sockets --w ith-ldap --w ith-ldap-sasl --w ith-xmlrpc --enable-zip -
-enable-soap
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/w ebserver/php/etc/php.ini
cd ../
4 、编译安装PHP5 扩展模块
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/w ebserver/php/bin/phpize
./configure --w ith-php-config=/usr/local/w ebserver/php/bin/php-config
make
make install
cd ../
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
/usr/local/w ebserver/php/bin/phpize
./configure --enable-eaccelerator=shared --w ith-php-config=/usr/local/w ebserver/php/bin/php-config
make
make install
cd ../
tar zxvf PDO_MYSQL-1.0.2.tgz
converted by Web2PDFConvert.com
7. cd PDO_MYSQL-1.0.2/
/usr/local/w ebserver/php/bin/phpize
./configure --w ith-php-config=/usr/local/w ebserver/php/bin/php-config --w ith-pdo-mysql=/usr/local/w ebserver/mysql
make
make install
cd ../
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../
tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/usr/local/w ebserver/php/bin/phpize
./configure --w ith-php-config=/usr/local/w ebserver/php/bin/php-config
make
make install
cd ../
5 、修改php.ini文件
手工修改: 查找/usr/local/w ebserver/php/etc/php.ini中的extension_dir = "./"
手工修改:
修改为extension_dir = "/usr/local/w ebserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
并在此行后增加以下几行,然后保存:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
再查找output_buffering = Off
修改为output_buffering = On
再查找; cgi.fix_pathinfo=0
修改为cgi.fix_pathinfo=0 ,防止Nginx文件类型错误解析漏洞。
自 动 修改: 若嫌手工修改麻烦,可执行以下shell命令,自动完成对php.ini文件的修改:
自
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/w ebserver/php/lib/php/extensions/no-debug-non-zts-
20060613/"nextension = "memcache.so"nextension = "pdo_mysql.so"nextension = "imagick.so"n#'
/usr/local/w ebserver/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/w ebserver/php/etc/php.ini
sed -i "s#; alw ays_populate_raw _post_data = On#alw ays_populate_raw _post_data = On#g"
/usr/local/w ebserver/php/etc/php.ini
sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/w ebserver/php/etc/php.ini
6 、配置eAccelerator加速PHP :
mkdir -p /usr/local/w ebserver/eaccelerator_cache
vi /usr/local/w ebserver/php/etc/php.ini
按shift+g 键跳到配置文件的最末尾,加上以下配置信息:
引用
[eaccelerator]
zend_extension="/usr/local/w ebserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/usr/local/w ebserver/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
7 、创建w w w 用户和组,以及供blog.s135.com和w w w .s135.com两个虚拟主机使用的目录:
/usr/sbin/groupadd w w w
/usr/sbin/useradd -g w w w w w w
mkdir -p /data0/htdocs/blog
chmod +w /data0/htdocs/blog
chow n -R w w w :w w w /data0/htdocs/blog
mkdir -p /data0/htdocs/w w w
chmod +w /data0/htdocs/w w w
chow n -R w w w :w w w /data0/htdocs/w w w
8 、创建php-fpm配置文件(php-fpm是为PHP 打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi):
在/usr/local/w ebserver/php/etc/ 目录中创建php-fpm.conf文件:
rm -f /usr/local/w ebserver/php/etc/php-fpm.conf
vi /usr/local/w ebserver/php/etc/php-fpm.conf
输入以下内容(如果您安装 Nginx + PHP 用于程序调试,请将以下的<value name="display_errors">0</value> 改为<value
name="display_errors">1</value> ,以便显示PHP 错误信息,否则,Nginx 会报状态为500 的空白错误页):
converted by Web2PDFConvert.com
8. <?xml version="1.0" ?>
<configuration>
All relative paths in this config are relative to php's install prefix
<section name="global_options">
Pid file
<value name="pid_file">/usr/local/w ebserver/php/logs/php-fpm.pid</value>
Error log file
<value name="error_log">/usr/local/w ebserver/php/logs/php-fpm.log</value>
Log level
<value name="log_level">notice</value>
W hen this amount of php processes exited w ith SIGSEGV or SIGBUS ...
<value name="emergency_restart_threshold">10</value>
... in a less than this interval of time, a graceful restart w ill be initiated.
Useful to w ork around accidental curruptions in accelerator's shared memory.
<value name="emergency_restart_interval">1m</value>
Time limit on w aiting child's reaction on signals from master
<value name="process_control_timeout">5s</value>
Set to 'no' to debug fpm
<value name="daemonize">yes</value>
</section>
<w orkers>
<section name="pool">
Name of pool. Used in logs and stats.
<value name="name">default</value>
Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">127.0.0.1:9000</value>
<value name="listen_options">
Set listen(2) backlog
<value name="backlog">-1</value>
Set permissions for unix socket, if one used.
In Linux read/w rite permissions must be set in order to allow connections from w eb server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name="ow ner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>
Additional php.ini defines, specific to this pool of w orkers.
<value name="php_defines">
<value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
<value name="display_errors">0</value>
</value>
Unix user of processes
<value name="user">w w w </value>
Unix group of processes
<value name="group">w w w </value>
Process manager settings
<value name="pm">
Sets style of controling w orker process count.
Valid values are 'static' and 'apache-like'
<value name="style">static</value>
Sets the limit on the number of simultaneous requests that w ill be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used w ith any pm_style.
<value name="max_children">128</value>
Settings group for 'apache-like' pm style
<value name="apache_like">
Sets the number of server processes created on startup.
Used only w hen 'apache-like' pm_style is selected
<value name="StartServers">20</value>
Sets the desired minimum number of idle server processes.
Used only w hen 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>
Sets the desired maximum number of idle server processes.
Used only w hen 'apache-like' pm_style is selected
<value name="MaxSpareServers">35</value>
</value>
converted by Web2PDFConvert.com
9. </value>
The timeout (in seconds) for serving a single request after w hich the w orker process w ill be terminated
Should be used w hen 'max_execution_time' ini option does not stop script execution for some reason
'0s' means 'off'
<value name="request_terminate_timeout">0s</value>
The timeout (in seconds) for serving of single request after w hich a php backtrace w ill be dumped to slow .log file
'0s' means 'off'
<value name="request_slow log_timeout">0s</value>
The log file for slow requests
<value name="slow log">logs/slow .log</value>
Set open file desc rlimit
<value name="rlimit_files">65535</value>
Set max core size rlimit
<value name="rlimit_core">0</value>
Chroot to this directory at the start, absolute path
<value name="chroot"></value>
Chdir to this directory at the start, absolute path
<value name="chdir"></value>
Redirect w orkers' stdout and stderr into main error log.
If not set, they w ill be redirected to /dev/null, according to FastCGI specs
<value name="catch_w orkers_output">yes</value>
How much requests each process should execute before respaw n.
Useful to w ork around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name="max_requests">1024</value>
Comma separated list of ipv4 addresses of FastCGI clients that allow ed to connect.
Equivalent to FCGI_W EB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only w ith AF_INET listening socket.
<value name="allow ed_clients">127.0.0.1</value>
Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
<value name="environment">
<value name="HOSTNAME">$HOSTNAME</value>
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
</value>
</section>
</w orkers>
</configuration>
9 、启动php-cgi进程,监听127.0.0.1 的9000 端口,进程数为128 (如果服务器内存小于3GB,可以只开启64 个进程),用户为w w w :
ulimit -SHn 65535
/usr/local/w ebserver/php/sbin/php-fpm start
注:/usr/local/w ebserver/php/sbin/php-fpm还有其他参数,包括:start|stop|quit|restart|reload|logrotate ,修改php.ini后不重
启php-cgi,重新加载配置文件使用reload 。
三、安装 Nginx 0.8.46
三、安装
1 、安装Nginx所需的pcre 库:
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/
./configure
make && make install
cd ../
2 、安装Nginx
tar zxvf nginx-0.8.46.tar.gz
cd nginx-0.8.46/
./configure --user=w w w --group=w w w --prefix=/usr/local/w ebserver/nginx --w ith-http_stub_status_module --w ith-
http_ssl_module
make && make install
cd ../
3 、创建Nginx日志目录
mkdir -p /data1/logs
chmod +w /data1/logs
chow n -R w w w :w w w /data1/logs
converted by Web2PDFConvert.com
10. 4 、创建Nginx配置文件
①、在/usr/local/w ebserver/nginx/conf/ 目录中创建nginx.conf文件:
rm -f /usr/local/w ebserver/nginx/conf/nginx.conf
vi /usr/local/w ebserver/nginx/conf/nginx.conf
输入以下内容:
引用
user w w w w w w ;
w orker_processes 8;
error_log /data1/logs/nginx_error.log crit;
pid /usr/local/w ebserver/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
w orker_rlimit_nofile 65535;
events
{
use epoll;
w orker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_w rite_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone craw ler $binary_remote_addr 10m;
server
{
listen 80;
server_name blog.s135.com;
index index.html index.htm index.php;
root /data0/htdocs/blog;
#limit_conn craw ler 20;
location ~ .*.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|sw f)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 1h;
}
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forw arded_for';
access_log /data1/logs/access.log access;
}
converted by Web2PDFConvert.com
11. server
{
listen 80;
server_name w w w .s135.com;
index index.html index.htm index.php;
root /data0/htdocs/w w w ;
location ~ .*.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
log_format w w w logs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forw arded_for';
access_log /data1/logs/w w w logs.log w w w logs;
}
server
{
listen 80;
server_name status.blog.s135.com;
location / {
stub_status on;
access_log off;
}
}
}
②、在/usr/local/w ebserver/nginx/conf/ 目录中创建fcgi.conf文件:
vi /usr/local/w ebserver/nginx/conf/fcgi.conf
输入以下内容:
引用
fastcgi_param GATEW AY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTW ARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP w as built w ith --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
5 、启动Nginx
ulimit -SHn 65535
/usr/local/w ebserver/nginx/sbin/nginx
四、配置 开 机自 动 启 动 Nginx + PHP
四、配置
vi /etc/rc.local
在末尾增加以下内容:
引用
ulimit -SHn 65535
/usr/local/w ebserver/php/sbin/php-fpm start
/usr/local/w ebserver/nginx/sbin/nginx
五、 优 化 Linux内核参数
五、
vi /etc/sysctl.conf
在末尾增加以下内容:
converted by Web2PDFConvert.com