√(-3╱5)^2+(64╱27)^3╱1-π^0+log∨2╱1(2)=

2013-2014学年高中数学(苏教版,必修1)同步辅导与检测课件:2.3.1..
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
学年高中数学(苏教版,必修1)同步辅导与检测课件:2.3.1对数(
2013高考)
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口Nginx 安裝教學(Nginx1.2.5+PHP5.3.19+MySQL5.5.27) | FAQ Book
Nginx 介紹
Nginx 是俄羅斯人所編寫,是一款高效能的 HTTP 和反向代理服務器。也是 IMAP/POP3/SMTP 代理服務器。Nginx (發音是engine x)由俄羅斯的程式設計師 Igor Sysoev所開發的。可安裝在 UNIX、GNU/Linux、FreeBSD、Mac OS X、 Solaris 以及 Microsoft Windows等操作系統中。在 ,使用 Nginx 當服務器或是代理服務器就佔全世界的11.48%。隨著 Nginx 在很多大型網站的廣泛使用,其穩定、高效的特性逐漸被越來越多的使用者認可。
Nginx 和 Apache 相比較下有以下優勢 :
性能上 : Nginx 使用較少的系統資源,能支持更多的開發,已達到更高的效能。
功能上 : Nginx 是優良的代理服務器和負載平衡服務器。
安裝上 : Nginx 安裝簡單且配置靈活。
更多介紹可參考 :
安裝環境 :
在此篇教學中所用到的所有套件,如果提供者載點死掉。都可在自行下載使用
Centos 5.8
Nginx 1.2.5
MySQL 5.5.28
安裝和更新常用套件
更新已有的套件
先把已安裝的套件更新一下。若不想更新已有的套件的話就略過
[root@localhost ~]# yum -y update
[root@localhost ~]# yum -y update
安裝常用套件
[root@localhost ~]# LANG=C
[root@localhost ~]# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib 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 patch zip bison
[root@localhost ~]# LANG=C[root@localhost ~]# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib 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 patch zip bison
編譯 安裝 MySQL 5.5.28
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.10.tar.gz
[root@localhost ~]# tar -zxvpf cmake-2.8.10.tar.gz
[root@localhost ~]# cd cmake-2.8.10
[root@localhost ~]# ./bootstrap --prefix=/usr/local/cmake
[root@localhost ~]# gmake && gmake install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.10.tar.gz[root@localhost ~]# tar -zxvpf cmake-2.8.10.tar.gz [root@localhost ~]# cd cmake-2.8.10[root@localhost ~]# ./bootstrap --prefix=/usr/local/cmake[root@localhost ~]# gmake && gmake install
修改 centos環境變數
[root@localhost ~]# vim /etc/profile
找到export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
下一行加入
export PATH=/usr/local/cmake/bin:$PATH
儲存後重啟系統
[root@localhost ~]# vim /etc/profile找到export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC下一行加入export PATH=/usr/local/cmake/bin:$PATH儲存後重啟系統
編譯 安裝 MySQL 5.5.28
1. 建立使用者和群組
[root@localhost ~]#
/usr/sbin/groupadd mysql
[root@localhost ~]#
/usr/sbin/useradd -g mysql mysql
[root@localhost ~]#&&/usr/sbin/groupadd mysql[root@localhost ~]#&&/usr/sbin/useradd -g mysql mysql
2. 編譯安裝 MySQL 以及修改權限
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://download./download/System/Linux/Nginx/mysql-5.5.28.tar.gz
[root@localhost ~]#
tar -zxvpf mysql-5.5.28.tar.gz
[root@localhost ~]#
cd mysql-5.5.28
[root@localhost ~]#
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/
[root@localhost ~]#
make && make install
[root@localhost ~]#
chmod +w /usr/local/webserver/mysql
[root@localhost ~]#
chown -R mysql:mysql /usr/local/webserver/mysql
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://download./download/System/Linux/Nginx/mysql-5.5.28.tar.gz[root@localhost ~]#&&tar -zxvpf mysql-5.5.28.tar.gz[root@localhost ~]#&&cd mysql-5.5.28[root@localhost ~]#&&cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/ [root@localhost ~]#&&make && make install[root@localhost ~]#&&chmod +w /usr/local/webserver/mysql[root@localhost ~]#&&chown -R mysql:mysql /usr/local/webserver/mysql
建立 MySQL 存放目錄
MySQL 存放目錄位置可自行修改,不過若有修改請注意後續設定的路徑
[root@localhost ~]# mkdir -p /data/mysql/3306/data/
[root@localhost ~]# mkdir -p /data/mysql/3306/binlog/
[root@localhost ~]# mkdir -p /data/mysql/3306/relaylog/
[root@localhost ~]# chown -R mysql:mysql /data/mysql/
[root@localhost ~]# mkdir -p /data/mysql/3306/data/ [root@localhost ~]# mkdir -p /data/mysql/3306/binlog/[root@localhost ~]# mkdir -p /data/mysql/3306/relaylog/[root@localhost ~]# chown -R mysql:mysql /data/mysql/
建立資料表
用MySQL用戶帳號的身份來建立資料表
[root@localhost ~]# /usr/local/webserver/mysql/scripts/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/data/mysql/3306/data --user=mysql
[root@localhost ~]# /usr/local/webserver/mysql/scripts/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/data/mysql/3306/data --user=mysql
建立my.cnf
[root@localhost ~]# vi /data/mysql/f
#輸入以下內容:
character-set-server = utf8
= /tmp/mysql.sock
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
= /tmp/mysql.sock
basedir = /usr/local/webserver/mysql
datadir = /data/mysql/3306/data
log-error = /data/mysql/3306/mysql_error.log
pid-file = /data/mysql/3306/mysql.pid
open_files_limit
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /data/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /data/mysql/3306/relaylog/relaylog
relay-log-info-file = /data/mysql/3306/relaylog/relaylog
relay-log = /data/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
interactive_timeout = 120
wait_timeout = 120
skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 6,48,1396
#master-host
192.168.1.2
#master-user
#master-password =
#master-port
server-id = 1
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
#log-slow-queries = /data/mysql/3306/slow.log
#long_query_time = 10
[mysqldump]
max_allowed_packet = 32M
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
[root@localhost ~]# vi /data/mysql/f#輸入以下內容:[client]character-set-server = utf8port&&&&= 3306socket&&= /tmp/mysql.sock[mysqld]character-set-server = utf8replicate-ignore-db = mysqlreplicate-ignore-db = testreplicate-ignore-db = information_schemauser&&&&= mysqlport&&&&= 3306socket&&= /tmp/mysql.sockbasedir = /usr/local/webserver/mysqldatadir = /data/mysql/3306/datalog-error = /data/mysql/3306/mysql_error.logpid-file = /data/mysql/3306/mysql.pidopen_files_limit&&&&= 10240back_log = 600max_connections = 5000max_connect_errors = 6000table_cache = 614external-locking = FALSEmax_allowed_packet = 32Msort_buffer_size = 1Mjoin_buffer_size = 1Mthread_cache_size = 300#thread_concurrency = 8query_cache_size = 512Mquery_cache_limit = 2Mquery_cache_min_res_unit = 2kdefault-storage-engine = MyISAMthread_stack = 192Ktransaction_isolation = READ-COMMITTEDtmp_table_size = 246Mmax_heap_table_size = 246Mlong_query_time = 3log-slave-updateslog-bin = /data/mysql/3306/binlog/binlogbinlog_cache_size = 4Mbinlog_format = MIXEDmax_binlog_cache_size = 8Mmax_binlog_size = 1Grelay-log-index = /data/mysql/3306/relaylog/relaylogrelay-log-info-file = /data/mysql/3306/relaylog/relaylogrelay-log = /data/mysql/3306/relaylog/relaylogexpire_logs_days = 30key_buffer_size = 256Mread_buffer_size = 1Mread_rnd_buffer_size = 16Mbulk_insert_buffer_size = 64Mmyisam_sort_buffer_size = 128Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1myisam_recover&interactive_timeout = 120wait_timeout = 120&skip-name-resolve#master-connect-retry = 10slave-skip-errors = 1032,1062,126,1114,1146,1048,1396&#master-host&&&& =&& 192.168.1.2#master-user&&&& =&& username#master-password =&& password#master-port&&&& =&&3306&server-id = 1&innodb_additional_mem_pool_size = 16Minnodb_buffer_pool_size = 512Minnodb_data_file_path = ibdata1:256M:autoextendinnodb_file_io_threads = 4innodb_thread_concurrency = 8innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 16Minnodb_log_file_size = 128Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120innodb_file_per_table = 0&#log-slow-queries = /data/mysql/3306/slow.log#long_query_time = 10&[mysqldump]quickmax_allowed_packet = 32M
建立 MySQL 開啟和關閉的 Shell
此shell的用途為管理MySQL的開啟和關閉
[root@localhost ~]# vi /data/mysql/3306/mysql
#輸入以下內容 :
mysql_port=3306
mysql_username="admin"
mysql_password=""
function_start_mysql()
printf "Starting MySQL...\n"
/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data/mysql/{mysql_port}/my.cnf 2&&1 & /dev/null &
function_stop_mysql()
printf "Stoping MySQL...\n"
/usr/local/webserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
function_restart_mysql()
printf "Restarting MySQL...\n"
function_stop_mysql
function_start_mysql
function_kill_mysql()
kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')
kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{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
printf "Usage: /data/mysql/{mysql_port}/mysql {start|stop|restart|kill}\n"
123456789101112131415161718192021222324252627282930313233343536373839404142434445
[root@localhost ~]# vi /data/mysql/3306/mysql#輸入以下內容 : #!/bin/sh&mysql_port=3306mysql_username="admin"mysql_password=""&function_start_mysql(){&&&&printf "Starting MySQL...\n"&&&&/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data/mysql/{mysql_port}/my.cnf 2&&1 & /dev/null &}&function_stop_mysql(){&&&&printf "Stoping MySQL...\n"&&&&/usr/local/webserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown}&function_restart_mysql(){&&&&printf "Restarting MySQL...\n"&&&&function_stop_mysql&&&&sleep 5&&&&function_start_mysql}&function_kill_mysql(){&&&&kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')&&&&kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{printf $2}')}&if [ "$1" = "start" ]; then&&&&function_start_mysqlelif [ "$1" = "stop" ]; then&&&&function_stop_mysqlelif [ "$1" = "restart" ]; thenfunction_restart_mysqlelif [ "$1" = "kill" ]; thenfunction_kill_mysqlelse&&&&printf "Usage: /data/mysql/{mysql_port}/mysql {start|stop|restart|kill}\n"fi
給shell可執行的權限
[root@localhost ~]# chmod +x /data/mysql/3306/mysql
[root@localhost ~]# chmod +x /data/mysql/3306/mysql
建立root權限的用戶
1. 啟動MySQL
[root@localhost ~]# /data/mysql/3306/mysql start
[root@localhost ~]# /data/mysql/3306/mysql start
2. 登入MySQL
尚未設定相關帳密,此部份先按Enter即可
[root@localhost ~]# /usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
[root@localhost ~]# /usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
3. 建立具有root權限的用戶
帳號:admin、密碼:。帳密部份可自行修改,但若有修改的話vi /data/mysql/3306/mysql也須要一起修改
mysql& GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '';
mysql& GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '';
mysql& quit
mysql& GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '';mysql& GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '';mysql& quitBye
4. 停用MySQL
[root@localhost ~]# /data/mysql/3306/mysql stop
[root@localhost ~]# /data/mysql/3306/mysql stop
設定軟連結
[root@localhost ~]# ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/local/lib
[root@localhost ~]# ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/local/lib
MySQL啟動和停用操作
[root@localhost ~]# /data/mysql/3306/mysql start
# 啟用MySQL
[root@localhost ~]# /data/mysql/3306/mysql stop
# 停用 MySQL
[root@localhost ~]# /data/mysql/3306/mysql start&&# 啟用MySQL[root@localhost ~]# /data/mysql/3306/mysql stop&& # 停用 MySQL
安装PHP 5.4.9相關模組
編譯安裝PHP5.4.9的相關模組
libiconv-1.14
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
[root@localhost ~]# tar -zxvpf libiconv-1.14.tar.gz
[root@localhost ~]# cd libiconv-1.14
[root@localhost ~]# ./configure --prefix=/usr/local
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz[root@localhost ~]# tar -zxvpf libiconv-1.14.tar.gz[root@localhost ~]# cd libiconv-1.14[root@localhost ~]# ./configure --prefix=/usr/local[root@localhost ~]# make && make install
libmcrypt-2.5.8
[root@localhost ~]# cd /opt
[root@localhost ~]# wget ftp://ftp.eenet.ee/pub/FreeBSD/distfiles/libmcrypt-2.5.8.tar.gz
[root@localhost ~]# tar -zxvpf libmcrypt-2.5.8.tar.gz
[root@localhost ~]# cd libmcrypt-2.5.8
[root@localhost ~]# ./configure
[root@localhost ~]# make && make install
[root@localhost ~]# /sbin/ldconfig
[root@localhost ~]# cd libltdl/
[root@localhost ~]# ./configure --enable-ltdl-install
[root@localhost ~]# make && make install
12345678910
[root@localhost ~]# cd /opt[root@localhost ~]# wget ftp://ftp.eenet.ee/pub/FreeBSD/distfiles/libmcrypt-2.5.8.tar.gz[root@localhost ~]# tar -zxvpf libmcrypt-2.5.8.tar.gz[root@localhost ~]# cd libmcrypt-2.5.8[root@localhost ~]# ./configure [root@localhost ~]# make && make install [root@localhost ~]# /sbin/ldconfig[root@localhost ~]# cd libltdl/[root@localhost ~]# ./configure --enable-ltdl-install[root@localhost ~]# make && make install
mhash-0.9.9.9
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download
[root@localhost ~]# tar -zxvpf mhash-0.9.9.9.tar.gz
[root@localhost ~]# cd mhash-0.9.9.9
[root@localhost ~]# ./configure --prefix=/usr/local
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download[root@localhost ~]# tar -zxvpf mhash-0.9.9.9.tar.gz[root@localhost ~]# cd mhash-0.9.9.9[root@localhost ~]# ./configure --prefix=/usr/local[root@localhost ~]# make && make install
mcrypt-2.6.8
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download
[root@localhost ~]# tar -zxvpf mcrypt-2.6.8.tar.gz
[root@localhost ~]# cd mcrypt-2.6.8
[root@localhost ~]# /sbin/ldconfig
[root@localhost ~]# LD_LIBRARY_PATH=/usr/local/lib ./configure
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download[root@localhost ~]# tar -zxvpf mcrypt-2.6.8.tar.gz[root@localhost ~]# cd mcrypt-2.6.8[root@localhost ~]# /sbin/ldconfig[root@localhost ~]# LD_LIBRARY_PATH=/usr/local/lib ./configure [root@localhost ~]# make && make install
設定軟連結
[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@localhost ~]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@localhost ~]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@localhost ~]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@localhost ~]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@localhost ~]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
[root@localhost ~]# ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
12345678910
[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4[root@localhost ~]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8[root@localhost ~]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a[root@localhost ~]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la[root@localhost ~]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so[root@localhost ~]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2[root@localhost ~]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1[root@localhost ~]# ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
編譯安裝PHP (FastCGI模式)
編譯 安裝PHP
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://download./download/System/Linux/Nginx/php-5.4.9.tar.gz
[root@localhost ~]# tar -zxvpf php-5.4.9.tar.gz
[root@localhost ~]# cd php-5.4.9
[root@localhost ~]# ./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib
--with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap [root@localhost ~]# make ZEND_EXTRA_LIBS='-liconv'
[root@localhost ~]# make install
[root@localhost ~]# cp /etc/php.ini /usr/local/webserver/php/etc/
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://download./download/System/Linux/Nginx/php-5.4.9.tar.gz[root@localhost ~]# tar -zxvpf php-5.4.9.tar.gz[root@localhost ~]# cd php-5.4.9[root@localhost ~]# ./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib&&--with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap [root@localhost ~]# make ZEND_EXTRA_LIBS='-liconv'[root@localhost ~]# make install[root@localhost ~]# cp /etc/php.ini /usr/local/webserver/php/etc/
安裝php-fpm
[root@localhost ~]# useradd php-fpm
[root@localhost ~]# cd /opt/php-5.4.9
#此為php-5.3.6的下載存放路徑
[root@localhost ~]# cp -f sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost ~]# chmod 755 /etc/init.d/php-fpm
[root@localhost ~]# cp -f sapi/fpm/php-fpm.conf.in /usr/local/webserver/php/etc/php-fpm.conf
[root@localhost ~]# vim /usr/local/webserver/php/etc/php-fpm.conf
#請更換為以下內容
pid = /usr/local/webserver/php/var/run/php-fpm.pid
listen = 127.0.0.1:9000
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.min_spare_servers = 3
pm.max_spare_servers = 35
pm.start_servers = 20
12345678910111213141516
[root@localhost ~]# useradd php-fpm[root@localhost ~]# cd /opt/php-5.4.9&&&& #此為php-5.3.6的下載存放路徑[root@localhost ~]# cp -f sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm[root@localhost ~]# chmod 755 /etc/init.d/php-fpm[root@localhost ~]# cp -f sapi/fpm/php-fpm.conf.in /usr/local/webserver/php/etc/php-fpm.conf[root@localhost ~]# vim /usr/local/webserver/php/etc/php-fpm.conf#請更換為以下內容pid = /usr/local/webserver/php/var/run/php-fpm.pidlisten = 127.0.0.1:9000user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.min_spare_servers = 3pm.max_spare_servers = 35pm.start_servers = 20
php-fpm啟用和停用操作
[root@localhost ~]# /sbin/chkconfig --add php-fpm
#加入到開機服務列表
[root@localhost ~]# /sbin/chkconfig php-fpm on
#設定開機自動開啟
[root@localhost ~]# /etc/init.d/php-fpm start
#啟動(或使用service php-fpm start)
[root@localhost ~]# /etc/init.d/php-fpm stop
#停止(或使用service php-fpm stop)
[root@localhost ~]# /etc/init.d/php-fpm reload
#重啟(或使用service php-fpm reload)
[root@localhost ~]# /sbin/chkconfig --add php-fpm&&#加入到開機服務列表[root@localhost ~]# /sbin/chkconfig php-fpm on&&#設定開機自動開啟[root@localhost ~]# /etc/init.d/php-fpm start&& #啟動(或使用service php-fpm start)[root@localhost ~]# /etc/init.d/php-fpm stop&&&&#停止(或使用service php-fpm stop)[root@localhost ~]# /etc/init.d/php-fpm reload&&#重啟(或使用service php-fpm reload)
安裝 PHP FastCGI模式的擴展模組
memcache-2.2.7
當前穩定版的是2.2.7版
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://pecl.php.net/get/memcache-2.2.7.tgz
[root@localhost ~]# tar -zxvpf memcache-2.2.7.tgz
[root@localhost ~]# cd memcache-2.2.7
[root@localhost ~]# /usr/local/webserver/php/bin/phpize
[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://pecl.php.net/get/memcache-2.2.7.tgz [root@localhost ~]# tar -zxvpf memcache-2.2.7.tgz[root@localhost ~]# cd memcache-2.2.7[root@localhost ~]# /usr/local/webserver/php/bin/phpize[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config[root@localhost ~]# make && make install
eaccelerator
為開源碼,是 PHP 的加速器,對動態內容和 PHP腳本的暫存優化,使其程式碼執行效率提高1-10倍。
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://download./download/System/Linux/Nginx/eaccelerator-eaccelerator-42067ac.tar.gz
[root@localhost ~]# tar -zxvpf
eaccelerator-eaccelerator-42067ac.tar.gz
[root@localhost ~]# cd eaccelerator-eaccelerator-42067ac
[root@localhost ~]# /usr/local/webserver/php/bin/phpize
[root@localhost ~]# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://download./download/System/Linux/Nginx/eaccelerator-eaccelerator-42067ac.tar.gz[root@localhost ~]# tar -zxvpf&&eaccelerator-eaccelerator-42067ac.tar.gz [root@localhost ~]# cd eaccelerator-eaccelerator-42067ac[root@localhost ~]# /usr/local/webserver/php/bin/phpize[root@localhost ~]# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config[root@localhost ~]# make && make install
PDO_MYSQL-1.0.2
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
[root@localhost ~]# tar -zxvpf PDO_MYSQL-1.0.2.tgz
[root@localhost ~]# cd PDO_MYSQL-1.0.2
[root@localhost ~]# ln -s /usr/local/webserver/mysql/include/* /usr/local/include/
[root@localhost ~]# /usr/local/webserver/php/bin/phpize
[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz [root@localhost ~]# tar -zxvpf PDO_MYSQL-1.0.2.tgz[root@localhost ~]# cd PDO_MYSQL-1.0.2[root@localhost ~]# ln -s /usr/local/webserver/mysql/include/* /usr/local/include/[root@localhost ~]# /usr/local/webserver/php/bin/phpize[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql[root@localhost ~]# make && make install
ImageMagick
在設定模組時,要先確定系統時間是否正確。
[root@localhost ~]# cd /opt
[root@localhost ~]# wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick.tar.gz
[root@localhost ~]# tar -zxvpf ImageMagick.tar.gz
[root@localhost ~]# cd ImageMagick-6.8.0-7
[root@localhost ~]# ./configure
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick.tar.gz [root@localhost ~]# tar -zxvpf ImageMagick.tar.gz[root@localhost ~]# cd ImageMagick-6.8.0-7[root@localhost ~]# ./configure[root@localhost ~]# make && make install
imagick-3.1.0RC2
此部份要注意一下,由於所安裝的PHP版本較新,所以在的部份要安裝最新版本才不會有問題
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
[root@localhost ~]# tar -zxvpf imagick-3.1.0RC2.tgz
[root@localhost ~]# cd imagick-3.1.0RC2
[root@localhost ~]# /usr/local/webserver/php/bin/phpize
[root@localhost ~]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz[root@localhost ~]# tar -zxvpf imagick-3.1.0RC2.tgz[root@localhost ~]# cd imagick-3.1.0RC2[root@localhost ~]# /usr/local/webserver/php/bin/phpize[root@localhost ~]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config[root@localhost ~]# make && make install
修改php.ini
[root@localhost ~]# vim /usr/local/webserver/php/etc/php.ini
extension_dir = "/usr/lib64/php/modules"
extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/"
# 然後在下方加入
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
# 再來找到
output_buffering = 4096
output_buffering = on
123456789101112131415
[root@localhost ~]# vim /usr/local/webserver/php/etc/php.ini# 先找到extension_dir = "/usr/lib64/php/modules"# 修改為extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/"&# 然後在下方加入extension = "memcache.so"extension = "pdo_mysql.so"extension = "imagick.so"&# 再來找到output_buffering = 4096# 修改為output_buffering = on
若是不想手動修改可下以下指令
[root@localhost ~]# sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/"\nextension = "memcache.so"\nextension = "pdo_mysql.so"\nextension = "imagick.so"\n#' /usr/local/webserver/php/etc/php.ini
[root@localhost ~]# sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/webserver/php/etc/php.ini
[root@localhost ~]# sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/webserver/php/etc/php.ini
[root@localhost ~]# sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/webserver/php/etc/php.ini
[root@localhost ~]# sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/"\nextension = "memcache.so"\nextension = "pdo_mysql.so"\nextension = "imagick.so"\n#' /usr/local/webserver/php/etc/php.ini[root@localhost ~]# sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/webserver/php/etc/php.ini[root@localhost ~]# sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/webserver/php/etc/php.ini [root@localhost ~]# sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/webserver/php/etc/php.ini
配置eaccelerator 加速PHP
[root@localhost ~]# mkdir -p /usr/local/webserver/eaccelerator_cache
[root@localhost ~]# vim /usr/local/webserver/php/etc/php.ini
#到文件最後面加上以下資料(可按shift+g到最後)
[eaccelerator]
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/usr/local/webserver/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"
press_level="9"
123456789101112131415161718
[root@localhost ~]# mkdir -p /usr/local/webserver/eaccelerator_cache[root@localhost ~]# vim /usr/local/webserver/php/etc/php.ini#到文件最後面加上以下資料(可按shift+g到最後)[eaccelerator]zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/eaccelerator.so"eaccelerator.shm_size="64"eaccelerator.cache_dir="/usr/local/webserver/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"
建立使用者及目錄
建立www使用者和群組,以及建立網頁資料存放目錄
[root@localhost ~]# /usr/sbin/groupadd www
[root@localhost ~]# /usr/sbin/useradd -g www www
[root@localhost ~]# mkdir -p /var/www/blog
[root@localhost ~]# chmod +w /var/www/blog
[root@localhost ~]# chown -R www:www /var/www/blog
[root@localhost ~]# /usr/sbin/groupadd www[root@localhost ~]# /usr/sbin/useradd -g www www[root@localhost ~]# mkdir -p /var/www/blog[root@localhost ~]# chmod +w /var/www/blog[root@localhost ~]# chown -R www:www /var/www/blog
安裝Nginx所需要的pcre
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://ftp.exim.llorien.org/pcre/pcre-8.31.tar.gz [root@localhost ~]# tar -zxvpf pcre-8.31.tar.gz
[root@localhost ~]# cd pcre-8.31
[root@localhost ~]# ./configure
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://ftp.exim.llorien.org/pcre/pcre-8.31.tar.gz [root@localhost ~]# tar -zxvpf pcre-8.31.tar.gz[root@localhost ~]# cd pcre-8.31[root@localhost ~]# ./configure[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt
[root@localhost ~]# wget http://nginx.org/download/nginx-1.2.5.tar.gz
[root@localhost ~]# tar -zxvpf nginx-1.2.5.tar.gz
[root@localhost ~]# cd nginx-1.2.5
[root@localhost ~]# ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
[root@localhost ~]# make && make install
[root@localhost ~]# cd /opt[root@localhost ~]# wget http://nginx.org/download/nginx-1.2.5.tar.gz[root@localhost ~]# tar -zxvpf nginx-1.2.5.tar.gz[root@localhost ~]# cd nginx-1.2.5[root@localhost ~]# ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module[root@localhost ~]# make && make install
建立Nginx log目錄
[root@localhost ~]# mkdir -p /data/logs
[root@localhost ~]# chmod +w /data/logs
[root@localhost ~]# chown -R www:www /data/logs
[root@localhost ~]# mkdir -p /data/logs[root@localhost ~]# chmod +w /data/logs[root@localhost ~]# chown -R www:www /data/logs
建立軟連結
[root@localhost ~]# ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
[root@localhost ~]# ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
建立nginx.conf
在/usr/local/webserver/nginx/conf/ 目錄中重新建立一個新的
[root@localhost ~]# mv /usr/local/webserver/nginx/conf/nginx.conf /usr/local/webserver/nginx/conf/nginx.conf.bak
[root@localhost ~]# vim /usr/local/webserver/nginx/conf/nginx.conf
#加入以下內容:
worker_processes
# 根據CPU和記憶體配置,設置2到10都OK
/data/logs/nginx_error.
# error log的存放路徑
/usr/local/webserver/nginx/nginx.
# pid的路徑
# 啟用epoll
worker_connections
default_type
application/octet-
log_format
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log
/data/logs/access.
keepalive_timeout
# 連線timeout秒數
/usr/local/webserver/nginx/
index.html index.htm index.
location ~\.php$ {
fastcgi_pass
127.0.0.1:9000;
fastcgi_index index.
fastcgi_param
SCRIPT_FILENAME
/usr/local/webserver/nginx/html$fastcgi_script_
include /usr/local/webserver/nginx/conf/fastcgi.
error_page
500 502 503 504
location = /50x.html {
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
[root@localhost ~]# mv /usr/local/webserver/nginx/conf/nginx.conf /usr/local/webserver/nginx/conf/nginx.conf.bak [root@localhost ~]# vim /usr/local/webserver/nginx/conf/nginx.conf#加入以下內容:user&&www www;worker_processes&&10;&& # 根據CPU和記憶體配置,設置2到10都OK&error_log&&/data/logs/nginx_error.log&&crit;&& # error log的存放路徑pid&&&&&&&&/usr/local/webserver/nginx/nginx.pid;&&# pid的路徑&events {&&&&use epoll;&& # 啟用epoll&&&&worker_connections&&1024;}&http {&&&&include&&&&&& mime.types;&&&&default_type&&application/octet-stream;&&&&&log_format&&main&&'$remote_addr - $remote_user [$time_local] "$request" '&&&&&&&&&&&&&&&&&&&&&&'$status $body_bytes_sent "$http_referer" '&&&&&&&&&&&&&&&&&&&&&&'"$http_user_agent" "$http_x_forwarded_for"';&&&&&access_log&&/data/logs/access.log&&main;&&&&&sendfile&&&&&&&&on;&&&&&keepalive_timeout&&65;&& # 連線timeout秒數&&&&&server {&&&&&&&&listen&&&&&& 80;&&&&&&&&server_name&&localhost;
/usr/local/webserver/nginx/html;
index.html index.htm index.php;&&&&&&&location ~\.php$ {&&&&&&&&&&&&fastcgi_pass&&127.0.0.1:9000;&&&&&&&&&&&&fastcgi_index index.php;&&&&&&&&&&&&fastcgi_param&&SCRIPT_FILENAME&&/usr/local/webserver/nginx/html$fastcgi_script_name;&&&&&&&&&&&&include /usr/local/webserver/nginx/conf/fastcgi.conf;&&&&&&&&&}&&&&&&&&&error_page&& 500 502 503 504&&/50x.html;&&&&&&&&location = /50x.html {&&&&&&&&&&&&root&& html;&&&&&&&&}&&&&&}&}
Nginx 常用操作
如果有做過修改的話可用以下指定測試修改後是否有問題
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -t
#如果測試後結果如下 就表示修改沒問題
nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -t#如果測試後結果如下 就表示修改沒問題nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful
在不停止Nginx服務情況下,重啟Nginx
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -s reload
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -s reload
開啟和停止
[root@localhost ~]#
ulimit -SHn 65535
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx
[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -s stop
[root@localhost ~]#&&ulimit -SHn 65535[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx&&&&&&&&&& #開啟[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx -s stop&& #停止
檢查是否正常
開網頁查看
在網址的地方輸入「http://ip或domain」。如果有看到出現「Welcome to nginx !」的字樣的話就表示安裝成功。接下來就是一些細部調整。
查看進程是否正常
[root@localhost ~]# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address
Foreign Address
PID/Program name
0 127.0.0.1:9000
7742/php-fpm
0 0.0.0.0:3306
8039/mysqld
0 0.0.0.0:80
7757/nginx
[root@localhost ~]# netstat -tulpnActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address&&&& Foreign Address&&&&&&&&State&&&&&&PID/Program name&& tcp&&&&&&&&0&&&&&&0 127.0.0.1:9000&&&&0.0.0.0:*&&&&&&&&&&&&&&LISTEN&&&&&&7742/php-fpm&&&&&&&&tcp&&&&&&&&0&&&&&&0 0.0.0.0:3306&&&&&&0.0.0.0:*&&&&&&&&&&&&&&LISTEN&&&&&&8039/mysqld&&&&&&&& tcp&&&&&&&&0&&&&&&0 0.0.0.0:80&&&&&&&&0.0.0.0:*&&&&&&&&&&&&&&LISTEN&&&&&&7757/nginx
查看phpinfo.php
到nginx.conf 所設定的 Web 目錄中,設定 phpinfo.php。可查詢相關套件是否有安裝成功。
設定方式如下
[root@localhost ~]# vim /usr/local/webserver/nginx/html/phpinfo.php
#加入以下內容
phpinfo();
[root@localhost ~]# vim /usr/local/webserver/nginx/html/phpinfo.php#加入以下內容&?phpphpinfo();?&
在都設定好後,可開啟網頁在網址的地方輸入「http://ip/phpinfo.php」就可看到以下內容
設定開機後自動啟動 Nginx、php-fpm和 MqSQL
[root@localhost ~]#
/etc/rc.d/rc.local
#在最後面加入以下內容
ulimit -SHn 65535
/etc/init.d/php-fpm start
/usr/local/webserver/nginx/sbin/nginx
/data/mysql/3306/mysql start
[root@localhost ~]#&&vi&&/etc/rc.d/rc.local#在最後面加入以下內容ulimit -SHn 65535/etc/init.d/php-fpm start /usr/local/webserver/nginx/sbin/nginx/data/mysql/3306/mysql start
或是直接輸入
[root@localhost ~]# echo "ulimit -SHn 65535" && /etc/rc.d/rc.local
[root@localhost ~]# echo "/etc/init.d/php-fpm start " && /etc/rc.d/rc.local
[root@localhost ~]# echo "/usr/local/webserver/nginx/sbin/nginx" && /etc/rc.d/rc.local
[root@localhost ~]# echo "/data/mysql/3306/mysql start" && /etc/rc.d/rc.local
[root@localhost ~]# echo "ulimit -SHn 65535" && /etc/rc.d/rc.local[root@localhost ~]# echo "/etc/init.d/php-fpm start " && /etc/rc.d/rc.local[root@localhost ~]# echo "/usr/local/webserver/nginx/sbin/nginx" && /etc/rc.d/rc.local[root@localhost ~]# echo "/data/mysql/3306/mysql start" && /etc/rc.d/rc.local
nginx.conf參數說明
以下是一些參數的調整和優化,可自行決定是否要增加或修改
#參數調整:
keepalive_timeout 50;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
#Fastcgi優化:
fastcgi_connect_timeout
fastcgi_send_timeout
fastcgi_read_timeout
fastcgi_buffer_size
fastcgi_buffers 4
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
#開啟gzip並優化:
gzip_min_length
gzip_buffers
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types
text/plain application/x-javascript text/css application/
12345678910111213141516171819202122232425262728
#參數調整:&&&&sendfile&&on;&&&&tcp_nopush&&on;&&&&tcp_nodelay&&on;&&&&server_tokens off;&&&&keepalive_timeout 50;&&&&server_names_hash_bucket_size 128;&&&&client_header_buffer_size 32k;&&&&large_client_header_buffers 4 32k;&&&&client_max_body_size 50m;&#Fastcgi優化:&&&&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_write_size 256k;&#開啟gzip並優化:&&&&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;
優化Linux內核參數
[root@localhost ~]# vi /etc/sysctl.conf
#到最後面加入以下內容 :
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog =
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max =
net.core.wmem_max =
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 000000
net.ipv4.tcp_max_orphans = 3276800
#net.ipv4.tcp_fin_timeout = 30
#net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range =
[root@localhost ~]# /sbin/sysctl -p
#使設定立即生效
123456789101112131415161718192021222324252627
[root@localhost ~]# vi /etc/sysctl.conf#到最後面加入以下內容 :# Addnet.ipv4.tcp_max_syn_backlog = 65536net.core.netdev_max_backlog =&&32768net.core.somaxconn = 32768&net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = net.core.wmem_max = &net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 2&net.ipv4.tcp_tw_recycle = 1#net.ipv4.tcp_tw_len = 1net.ipv4.tcp_tw_reuse = 1&net.ipv4.tcp_mem =
net.ipv4.tcp_max_orphans = 3276800&#net.ipv4.tcp_fin_timeout = 30#net.ipv4.tcp_keepalive_time = 120net.ipv4.ip_local_port_range = 1024&&65535[root@localhost ~]# /sbin/sysctl -p&&&&&& #使設定立即生效
設定定時分割 Nginx log 的腳本
建立新腳本
[root@localhost ~]# vi /usr/local/webserver/nginx/sbin/cut_nginx_log.sh
#輸入以下內容
#!/bin/bash
# This script run at 00:00
# The Nginx logs path
logs_path="/usr/local/webserver/nginx/logs/"
mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/
mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 `cat /usr/local/webserver/nginx/nginx.pid`
1234567891011
[root@localhost ~]# vi /usr/local/webserver/nginx/sbin/cut_nginx_log.sh#輸入以下內容#!/bin/bash# This script run at 00:00&# The Nginx logs pathlogs_path="/usr/local/webserver/nginx/logs/"&mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").logkill -USR1 `cat /usr/local/webserver/nginx/nginx.pid`
設定crontab 時間可以自設
[root@localhost ~]#
crontab -e
#加入以下內容
00 00 * * * /bin/bash
/usr/local/webserver/nginx/sbin/cut_nginx_log.sh
[root@localhost ~]#&&crontab -e#加入以下內容00 00 * * * /bin/bash&&/usr/local/webserver/nginx/sbin/cut_nginx_log.sh
Nginx 的安裝到這邊就大致完成
一個半路殺出來的傻小子,憑著一股傻勁努力的學習、嘗試、分享。希望能用自己微薄之力,替IT界和資訊界盡一點心力。單憑一己之力始終還是有限,歡迎和我有相同理念的夥伴一同加入一同努力。
贊助我們希望能給我們一些支持
讓我們繼續努力寫作。
FAQ BOOK由製作,以釋出。此作品衍生自。超出此條款範圍外的授權可於查閱。
SEO Powered by

我要回帖

更多关于 已知x满足不等式2 log 的文章

 

随机推荐