阿里云linux配置
CenOS 6.3 + nginx 1.2.4 + PHP 5.4.8 + MySQL 5.5.28 完整配置
# vi /etc/profile添加:LANG=zh_CN.GB2312export LANG使环境变量生效 保存后 断开 SSH 重新连接# source /etc/profile注意:如果有添加这一步,在设置 mysql 密码时会出现个 sql 编码问题,需要注释掉这里的设置断开ssh后重连就可以了
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime同步时间# /usr/bin/rdate -s rdate.darkorb.net写入 BIOS 避免失效# hwclock -w建议加入定时同步# crontab -e# 0 0 * * * /usr/bin/rdate -s rdate.darkorb.net
# cd /etc/yum.repos.d# mv CentOS-Base.repo CentOS-Base.repo.bak# yum makecache
# sudo -s# LANG=C# 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 ntpd nmap patch cmake bison cgi* *-gd-* libtool-* gettext *libxml-devel libcurl-devel libevent libevent-devel net-snmp-devel lsof unzip如果出现错误 如:Error: Package: glibc-headers-2.12-1.80.el6_3.4.x86_64 (updates)
# vi /etc/ld.so.conf添加:/usr/lib//usr/local/lib//usr/lib64//usr/local/lib64/
# reboot
新建保存下载软件的目录# mkdir -p /mydata/soft# mkdir -p /var/www/html# cd /mydata/soft/下载:
针对 64 位操作系统必须安装 libunwind 库# tar zxvf libunwind-1.1.tar.gz# cd libunwind-1.1/# CFLAGS=-fPIC ./configure# make CFLAGS=-fPIC# make CFLAGS=-fPIC install# cd ../
安装 google-perftools 优化# tar zxvf gperftools-2.0.tar.gz# cd gperftools-2.0/# ./configure# make && make install# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf# /sbin/ldconfig# cd ..
# tar zxvf pcre-8.31.tar.gz# cd pcre-8.31# ./configure# make && make install# cd ../
# tar zxvf nginx-1.2.4.tar.gz# cd nginx-1.2.4# ./configure --prefix=/usr/local/nginx --with-google_perftools_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/mydata/soft/pcre-8.31# make && make install#cd ../
# mkdir /tmp/tcmalloc# chmod 0777 /tmp/tcmalloc
# /usr/sbin/groupadd www# /usr/sbin/useradd -g www www
# vi /usr/local/nginx/conf/nginx.conf注意:要在 pid 下一行添加下面的代码才能使优化生效google_perftools_profiles /tmp/tcmalloc;
示例:替换为以下内容
user www www;worker_processes 4;worker_cpu_affinity 0001 0100 1000 0010;
error_log logs/error.log;pid logs/nginx.pid;worker_rlimit_nofile 65535;google_perftools_profiles /tmp/tcmalloc;
events {worker_connections 65535;}
http {#include deny_ips.conf;include mime.types;default_type application/octet-stream;server_tokens off;
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 logs/access.log main;
server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 50m;
sendfile on;tcp_nopush on;tcp_nodelay on;
keepalive_timeout 60;
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;fastcgi_intercept_errors on;
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;
include vhost/*.conf;}
# ulimit -SHn 65535# /usr/local/nginx/sbin/nginx
# lsof -n | grep tcmalloc显示如下:nginx 2395 nobody 9w REG 8,8 0 1599440 /tmp/tcmalloc.2395nginx 2396 nobody 11w REG 8,8 0 1599443 /tmp/tcmalloc.2396nginx 2397 nobody 13w REG 8,8 0 1599441 /tmp/tcmalloc.2397nginx 2398 nobody 15w REG 8,8 0 1599442 /tmp/tcmalloc.2398由于在Nginx配置文件中,设置worker_processes的值为4,因此开启了4个Nginx线程,每个线程会有一行记录。每个线程文件后面的数字值就是启动的Nginx的PID值。至此,利用TCMalloc优化Nginx的操作完成。
# vi /etc/sysctl.conf末尾添加:net.ipv4.tcp_max_tw_buckets = 6000net.ipv4.ip_local_port_range = 1024 65000net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_syncookies = 1net.core.somaxconn = 262144net.core.netdev_max_backlog = 262144net.ipv4.tcp_max_orphans = 262144net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 30刷新配置# /sbin/sysctl -p
# cd /usr/local/nginx/conf# mkdir vhost
# vi vhost/localhost.conf添加:server{listen 80;server_name localhost;index index.html index.php;root /var/www/html/;
#limit_conn crawler 20;
location ~ .*\.(php|php5)?${#fastcgi_pass unix:/tmp/php-cgi.sock;#upload filesize limit#client_max_body_size 10m;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;}}
查看系统是否有安装过 MySQL注意大小写,如果mysql 不行就换MySQL# rpm -qa | grep mysql显示如:mysql-5.1.61-4.el6.x86_64将搜索出的包名全部卸载:(nodeps表示强制删除),例如:# rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64
# cd /mydata/soft
# /usr/sbin/groupadd mysql# /usr/sbin/useradd -g mysql mysql
# chmod +w /usr/local/mysql# chown -R mysql:mysql /usr/local/mysql# mkdir -p /var/mysql/data/# mkdir -p /var/mysql/log/# chown -R mysql:mysql /var/mysql/# mkdir /home/mysql/temp# chown -R mysql:mysql /home/mysql/temp
# tar xvf mysql-5.5.28.tar.gz# cd mysql-5.5.28/# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DENABLED_LOCAL_INFILE=ON \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_USER=mysql \-DMYSQL_DATADIR=/var/mysql/data
以上代码合并为:cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql-DMYSQL_DATADIR=/var/mysql/data
以上代码安装DiscuzX_gbk时,提示数据库不支持GBK,使用下面代码成功运行cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_EXTRA_CHARSETS:STRING=gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql-DMYSQL_DATADIR=/var/mysql/data# make && make install
# cd support-files/注意:my-large.cnf 适用于1G内存左右的服务器,可以根据自己配置情况选用 my-large.cnf 或 my-huge.cnf 等不同配置# cp my-huge.cnf /etc/my.cnf
之前这里 my.cnf 的路径设置有问题(现已修改),导致没有生效,今天关闭 innodb 时才发现。。是放在 etc 下面才会生效的。。参考配置:关闭 innodb,binlog 保存 30 天内的# vi /etc/my.cnf--------------------------------------忽略分隔线---------------------------------------
[client]port = 3306socket = /usr/local/mysql/mysql.sock
[mysqld]character-set-server = utf8replicate-ignore-db = mysqlreplicate-ignore-db = testreplicate-ignore-db = information_schemauser = mysqlport = 3306socket = /usr/local/mysql/mysql.sockbasedir = /usr/local/mysqldatadir = /var/mysql/datatmpdir = /home/mysql/templog-error = /var/mysql/log/error.logpid-file = /var/mysql/mysql.pidopen_files_limit = 10240back_log = 200max_connections = 1024max_connect_errors = 1024table_cache = 614external-locking = FALSEmax_allowed_packet = 32Msort_buffer_size = 4Mjoin_buffer_size = 1Mthread_cache_size = 300thread_concurrency = 4query_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 = /var/mysql/binlog/binlogbinlog_cache_size = 4Mbinlog_format = MIXEDmax_binlog_cache_size = 8Mmax_binlog_size = 1G#relay-log-index = /var/mysql/relaylog/relaylog#relay-log-info-file = /var/mysql/relaylog/relaylog#relay-log = /var/mysql/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-resolveslave-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
skip-innodb
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
slow-query-log = Onslow-query-log-file = /var/mysql/log/slow.loglong_query_time = 30
[mysqldump]quickmax_allowed_packet = 32M
--------------------------------------忽略分隔线---------------------------------------
# cp mysql.server /etc/init.d/mysqld# cd ../../
# /usr/local/mysql/scripts/mysql_install_db \--defaults-file=/var/mysql/my.cnf \--basedir=/usr/local/mysql \--datadir=/var/mysql/data \--user=mysql原文加粗地方有错,应为:/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/mysql/data --user=mysql
# chmod +x /etc/init.d/mysqld# vi /etc/init.d/mysqld查找并修改:basedir=/usr/local/mysqldatadir=/var/mysql/data
# chkconfig --add mysqld# chkconfig --level 2345 mysqld on
# service mysqld start# /usr/local/mysql/bin/mysqladmin -u root password "123456"错误一:mysqladmin, mysql ... 命令无法执行:# export PATH=/usr/local/mysql/binPATH错误二:Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)# yum install ncurses-devel
# vi /usr/local/mysql/bin/mysqld_safe在 executing mysqld_safe 的下一行,加上:export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
启动 mysql:# service mysqld restart使用lsof命令查看tcmalloc是否起效:# /usr/sbin/lsof -n | grep tcmalloc如果发现以下信息,说明tcmalloc已经起效:mysqld 10847 mysql mem REG 8,5 1203756 20484960 /usr/local/lib/libtcmalloc.so.0.0.0
# cd /mydata/soft
这部分代码安装过好多太服务器几乎没有什么问题,可以直接全部复制粘贴到ssh就好了,我就不打 # 号了
tar zxvf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/localmake && make installcd ../
tar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8/./configuremake && make install/sbin/ldconfigcd libltdl/./configure --enable-ltdl-installmake && make installcd ../../
tar zxvf mhash-0.9.9.9.tar.gzcd mhash-0.9.9.9/./configuremake && make installcd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.laln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.soln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.aln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.laln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.soln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-configln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.laln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.soln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.aln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.laln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.soln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18ln -sv /usr/lib64/libldap* /usr/lib/
tar zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8//sbin/ldconfig./configuremake && make installcd ../
# mkdir -p /usr/local/php/etc/php.d/
# tar xvzf php-5.4.8.tar.gz# cd php-5.4.8/# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc \--with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config \--with-pdo-mysql=/usr/local/mysql/ --with-iconv-dir=/usr/local --enable-fpm \--disable-phar --with-fpm-user=www --with-fpm-group=www --with-pcre-regex \--with-config-file-scan-dir=/usr/local/php/etc/php.d \--with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir \--enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir \--enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt \--enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip \--enable-bcmath --with-snmp --disable-ipv6 --with-xmlrpc --with-ldap --with-ldap-sasl --enable-exif \--enable-soap --enable-pdo --with-pdo-mysql --enable-sysvsem --enable-inline-optimization --with-curlwrappers
以上代码合并为:./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/ --with-iconv-dir=/usr/local --enable-fpm --disable-phar --with-fpm-user=www --with-fpm-group=www --with-pcre-regex --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --with-snmp --disable-ipv6 --with-xmlrpc --with-ldap --with-ldap-sasl --enable-exif --enable-soap --enable-pdo --with-pdo-mysql --enable-sysvsem --enable-inline-optimization --with-curlwrappers
# make ZEND_EXTRA_LIBS=‘-liconv‘# make test# make install# cp php.ini-production /usr/local/php/etc/php.ini
# PATH=/usr/local/php/binPATH# PATH=/usr/local/php/sbinPATH
提示:--enable-fastcgi --enable-force-cgi-redirect PHP 5.3以后已经强制开启了 fastcgi 了,具体查看官方说明:https://bugs.php.net/bug.php?id=50840&edit=1 最下面 FastCGI is now always enabled and cannot be disabled.错误:configure: error: Cannot find ldap libraries in /usr/lib.解决办法:ln -sv /usr/lib64/libldap* /usr/lib/
注意 make test 的时候可能会出现 :/mnt/sun/php-5.4.8/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory32位系统# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.1864位系统# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm# chmod +x /etc/init.d/php-fpm# chkconfig --add php-fpm# chkconfig --level 2345 php-fpm on# cd ../
PHP5.3.3以上版本的php-fpm重启、停止命令已经不是php-fpm start|stop|reload了,需要使用信号控制:启动脚本可参照网上。
memcached 把我搞晕了,有两个 memcached,我也不是很清楚具体区别,按我的理解应该是分为 服务器版 和 php 扩展版一开始用 服务器版来编译 php 扩展,搞了半天都没弄出来,后来才发现居然有两个,晕死了
安装依赖包:# tar zxvf libevent-2.0.20-stable.tar.gz# cd libevent-2.0.20-stable# ./configure --prefix=/usr/local/libevent# make && make install# cd ../
# tar xvzf memcached-1.4.15.tar.gz# cd memcached-1.4.15# ./configure --enable-64bit --enable-threads --with-libevent=/usr/local/libevent# make && make install# cd ../
检测是否安装成功:# ls -al /usr/local/bin/memcached# mkdir -p /var/run/memcached/
启动 memcached:# /usr/local/bin/memcached -d -m 128 -u root -l 22.11.5.91 -p 11211 -c 256 -P /var/run/memcached/memcached.pid# ps aux|grep memcached
关闭 memcached:# kill `cat /var/run/memcached/memcached.pid`
新建启动和关闭脚本并赋执行权限:# cp memcached-1.4.15/scripts/memcached.sysv /etc/init.d/memcached# chmod 755 /etc/init.d/memcached
修改配置:# vi /etc/init.d/memcached修改:PORT=11212USER=rootOPTIONS=""
查找:daemon memcached -d -p ....修改为:daemon /usr/local/bin/memcached -d -p ....
添加下面两行:chown $USER /usr/local/bin/memcached/usr/local/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcache/memcached.pid $OPTIONS
添加到系统服务:# chkconfig --add memcached# chkconfig --level 2345 memcached on# chkconfig --list memcached
测试启动 检测 关闭:# service memcached start# ps aux|grep memcached# service memcached stop
开启防火墙外网访问(单机可忽略该设置):# iptables -I INPUT -p tcp --dport 11211 -j ACCEPT# iptables -I OUTPUT -p tcp --sport 11211 -j ACCEPT# iptables-save# service iptables save
依赖库:# tar zxvf libmemcached-1.0.13.tar.gz# cd libmemcached-1.0.13# ./configure --prefix=/usr/local/libmemcached# make && make install# cd ../
安装 memcached# tar vxzf memcached-2.1.0.tgz# cd memcached-2.1.0# /usr/local/php/bin/phpize# ./configure --enable-memcached --with-libmemcached-dir=/usr/local/libmemcached --with-php-config=/usr/local/php/bin/php-config# make && make install# cd ..
# tar zxvf memcache-3.0.7.tgz# cd memcache-3.0.7/# /usr/local/php/bin/phpize# ./configure --prefix=/usr/local/memcache --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir# make && make install# cd ../
# tar zxvf ImageMagick-6.8.0-4.tar.gz# cd ImageMagick-6.8.0-4/# export CFLAGS=‘-fPIC‘# ./configure --prefix=/usr/local/ImageMagick --with-quantum-depth=8 --enable-share --enable-static# make && make install# cd ../
# tar zxvf imagick-3.1.0RC2.tgz# cd imagick-3.1.0RC2/# /usr/local/php/bin/phpize# export PKG_CONFIG_PATH=/usr/local/ImageMagick/lib/pkgconfig/# ./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/ImageMagick# make && make install# cd ../
# mv master eaccelerator-eaccelerator-42067ac.tar.gz# tar zxvf eaccelerator-eaccelerator-42067ac.tar.gz# cd eaccelerator-eaccelerator-42067ac/# /usr/local/php/bin/phpize# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config# make && make install# cd ../
新建目录:# mkdir /tmp/eaccelerator_cache# chmod 0777 /tmp/eaccelerator_cache
打开自动扫描的扩展目录:# cd /usr/local/php/etc/php.d--------------------------------忽略分割线------------------------------
# vi eaccelerator.ini写入:[eaccelerator]zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"eaccelerator.shm_size="20"eaccelerator.cache_dir="/tmp/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"
--------------------------------忽略分割线------------------------------
# vi memcache.ini写入:extension = "memcache.so"memcache.chunk_size = 32768
--------------------------------忽略分割线------------------------------
# vi memcached.ini写入:extension = "memcached.so"
--------------------------------忽略分割线------------------------------
# vi imagick.ini写入:extension = "imagick.so"
--------------------------------忽略分割线------------------------------
修改php配置:
# vi /usr/local/php/etc/php.ini查找并修改:cgi.fix_pathinfo=0extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/"expose_php = Offallow_url_fopen = Offopen_basedir = /tmp/:/var/www/disable_functions = exec,system,passthru,chroot,scandir,chgrp,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_serverdate.timezone = Asia/Shanghai
拷贝 php-fpm 配置:# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf# vi /usr/local/php/etc/php-fpm.conf
查找并修改:以下为示例数值,按自己服务器实际性能配置:pm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 10240rlimit_files = 65535
# vi /etc/rc.local写入:ulimit -SHn 65535service mysqld startservice php-fpm startservice memcached startservice nginx start
以上教程是基础环境的教程还需要在配置PHP的时候加于GD2扩展不然你的SHOPNC在上传商品图片的时候会不显示。安装完后再加REDIS扩展。并且用探针软件检查好各SHOPNC要求的函数是否支持。如果有问题可联系。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。