linux + nginx + php + mysql + memcache + mongodb + zend guard loader
mongo 配置:
define('KVSTORE_STORAGE', 'base_kvstore_mongodb'); define('MONGODB_SERVER_CONFIG', 'mongodb://localhost:27017');
memcahed 配置 :
define('CACHE_STORAGE', 'base_cache_memcache'); define('CACHE_MEMCACHE_CONFIG', '127.0.0.1:11211');
use ecos db.defalut.ensureIndex({key:1})
set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info;
扩展安装:
1. Extract the Zend Loader package. 2. Locate and extract the ZendGuardLoader.so (Linux) or ZendLoader.dll (Windows) that corresponds to your php version. 3. Add the following line to your php.ini file for loading the ZendGuardLoader: Linux and Mac OS X: zend_extension=<full_path_to_ZendGuardLoader.so> Windows non-thread safe: zend_extension=<full_path_to_ZendLoader.dll> 4. Add an aditional line to your php.ini for enabling ZendGuardLoader ; Enables loading encoded scripts. The default value is On zend_loader.enable=1 5. Optional: following lines can be added your php.ini file for ZendGuardLoader configuration: ; Disable license checks (for performance reasons) zend_loader.disable_licensing=0 ; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 - no obfuscation is enabled zend_loader.obfuscation_level_support=3 ; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide zend_loader.license_path= 6. If you use Zend debugger as well, please make sure to load it after the Zend guard Loader 7. If you use ioncube loader, please make sure to load it before Zend guard Loader 8. Restart your Web server.
license文件设置:
zend_loader.license_path= /path/to/license.zl
1. 关闭不需要的tty
$ vim /etc/inittab 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 #3:2345:respawn:/sbin/mingetty tty3 #4:2345:respawn:/sbin/mingetty tty4 #5:2345:respawn:/sbin/mingetty tty5 #6:2345:respawn:/sbin/mingetty tty6 $ initq
2. 对TCP/IP网络参数进行调整
$ echo 'net.ipv4.tcp_syncookies = 1' >> /etc/sysctl.conf $ sysctl -p3. 修改shell命令的history 记录个数
$ vim /etc/profile HISTSIZE=1004. 定时校正服务器时间
$ yum install ntp $ crontab -e */5 * * * * ntpdate ntp.api.bz5. 停止打印服务
$ /etc/rc.d/init.d/cups stop $ chkconfig --list cups 确认是否关闭6. 停止ipv6
$ ifconfig -a $ vim /etc/modprobe.conf alias net -pf -10 off alias ipv6 off $ echo "IPV6INIT = no " >> /etc/sysconfig/network-scripts/ifconfig-eth0 $ shutdown -r now7. 调整linux 最大文件打开数
$ vim /etc/rc.local ulimit -SHn 655358. 关闭写磁盘I/0功能
$ vim /etc/fstab /dev/sda5 /data/ ext3 noatime,nodiratime 0 09. 优化内核TCP参数
$ vim /etc/sysctl.conf net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_keepalive_time = 1200 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 8192 net.ipv4.tcp_max_tw_buckets = 5000 $ sysctl -p
worker_processes 8; worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; worker_connections 65535; keepalive_timeout 60; client_header_buffer_size 8k; worker_rlimit_nofile 65535;