MYSQL my.conf
# The following options would be passed to all MySQL clients
[Client]
#password = Your_password
Port = 3306
Socket =/tmp/mysql.sock
# here follows entries for some specific programs
# The MySQL server
[Mysqld]
Default-storage-engine=myisam
Port = 3306
Socket =/tmp/mysql.sock
Skip-external-locking
Key_buffer_size = 2048M
Max_allowed_packet = 32M
Table_open_cache = 512
Sort_buffer_size = 64M
Net_buffer_length = 8M
Read_buffer_size = 128M
Read_rnd_buffer_size = 64M
Myisam_sort_buffer_size = 64M
Max_connections = 10240
# Don ' t listen on a TCP/IP port at all. This can is a security enhancement,
# If all processes this need to connect to mysqld run on the same host.
# All interaction with Mysqld must is made via Unix sockets or named pipes.
# Note that the using this option without enabling named Pipes on Windows
# (via the "enable-named-pipe" option) would render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# Binary logging is required for replication
Log-bin=mysql-bin
# Binary Logging format-mixed recommended
Binlog_format=mixed
# required Unique ID between 1 and 2^32-1
# defaults to 1 if master-host are not set
# but would not function as a master if omitted
Server-id = 1
# Replication Slave (Comment out master sections to use this)
#
# To configure the host as a replication slave, you can choose between
# methods:
#
# 1) Use the Change MASTER to command (fully described in our manual)-
# The syntax is:
#
# change MASTER to Master_host=# master_user=<user>, master_password=<password>;
#
# where you replace the # <port> by the master's port number (3306 by default).
#
# Example:
#
# change MASTER to master_host= ' 125.564.12.1 ', master_port=3306,
# master_user= ' Joe ', master_password= ' secret ';
#
# OR
#
# 2) Set the variables below. However, in case you choose the This method, then
# Start replication for the first time (even unsuccessfully, for example
# If you mistyped the password in Master-password and the slave fails to
# Connect), the slave would create a master.info file, and any later
# change in this file to the variables ' values below'll be ignored and
# Overridden by the content of the Master.info file, unless you shutdown
# The slave server, delete master.info and restart the slaver server.
# for this reason, want to leave the lines below untouched
# (commented) and instead use change MASTER to (see above)
#
# required Unique ID between 2 and 2^32-1
# (and different from the master)
# defaults to 2 if Master-host is set
# but would not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave-required
#master-host = #
# The username the slave would use for authentication when connecting
# to the master-required
#master-user = <username>
#
# The password the slave would authenticate with when connecting to
# The Master-required
#master-password = <password>
#
# The Port the master is listening on.
# Optional-defaults to 3306
#master-port = <port>
#
# binary Logging-not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you is using InnoDB tables
#innodb_data_home_dir =/data/db/my
#innodb_data_file_path = Ibdata1:10m:autoextend
#innodb_log_group_home_dir =/data/db/my
# you can set: _buffer_pool_size up to 50-80%
# of RAM But beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set: _log_file_size to% of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[Mysqldump]
Quick
Max_allowed_packet = 16M
[MySQL]
No-auto-rehash
# Remove The next comment character if you is not a familiar with SQL
#safe-updates
[Myisamchk]
Key_buffer_size = 20M
Sort_buffer_size = 20M
Read_buffer = 2M
Write_buffer = 2M
[Mysqlhotcopy]
Interactive-timeout
PHP
[PHP]
Engine = On
Short_open_tag = On
Asp_tags = Off
Precision = 14
Output_buffering = 4096
Zlib.output_compression = Off
Implicit_flush = Off
Unserialize_callback_func =
Serialize_precision = 17
Disable_functions =
Disable_classes =
ZEND.ENABLE_GC = On
expose_php = On
Max_execution_time = 30
Max_input_time = 60
Memory_limit = 128M
error_reporting = e_all & ~e_notice | E_strict & ~e_strict
Display_errors = On
Display_startup_errors = Off
Log_errors = On
Log_errors_max_len = 1024
Ignore_repeated_errors = Off
Ignore_repeated_source = Off
Report_memleaks = On
Track_errors = Off
Html_errors = On
Variables_order = "GPCs"
Request_order = "GP"
REGISTER_ARGC_ARGV = Off
Auto_globals_jit = On
Post_max_size = 100M
Auto_prepend_file =
Auto_append_file =
Default_mimetype = "Text/html"
Doc_root =
User_dir =
ENABLE_DL = Off
File_uploads = On
Upload_max_filesize = 100M
Max_file_uploads = 20
Allow_url_fopen = On
Allow_url_include = Off
Default_socket_timeout = 60
[CLI Server]
Cli_server.color = On
[Date]
Date.timezone = PRC
[Filter]
[Iconv]
[Intl]
[SQLite]
[Sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[Mail Function]
SMTP = localhost
Smtp_port = 25
Mail.add_x_header = On
[SQL]
Sql.safe_mode = Off
[ODBC]
Odbc.allow_persistent = On
Odbc.check_persistent = On
Odbc.max_persistent =-1
Odbc.max_links =-1
ODBC.DEFAULTLRL = 4096
Odbc.defaultbinmode = 1
[Interbase]
Ibase.allow_persistent = 1
Ibase.max_persistent =-1
Ibase.max_links =-1
Ibase.timestampformat = "%y-%m-%d%h:%m:%s"
Ibase.dateformat = "%y-%m-%d"
Ibase.timeformat = "%h:%m:%s"
[MySQL]
Mysql.allow_local_infile = On
Mysql.allow_persistent = On
mysql.cache_size = 2000
Mysql.max_persistent =-1
Mysql.max_links =-1
Mysql.default_port =
Mysql.default_socket =
Mysql.default_host =
Mysql.default_user =
Mysql.default_password =
Mysql.connect_timeout = 60
Mysql.trace_mode = Off
[Mysqli]
Mysqli.max_persistent =-1
Mysqli.allow_persistent = On
Mysqli.max_links =-1
mysqli.cache_size = 2000
Mysqli.default_port = 3306
Mysqli.default_socket =
Mysqli.default_host =
Mysqli.default_user =
MYSQLI.DEFAULT_PW =
Mysqli.reconnect = Off
[Mysqlnd]
Mysqlnd.collect_statistics = On
Mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
Pgsql.allow_persistent = On
Pgsql.auto_reset_persistent = Off
Pgsql.max_persistent =-1
Pgsql.max_links =-1
Pgsql.ignore_notice = 0
Pgsql.log_notice = 0
[SYBASE-CT]
Sybct.allow_persistent = On
Sybct.max_persistent =-1
Sybct.max_links =-1
Sybct.min_server_severity = 10
Sybct.min_client_severity = 10
[Bcmath]
Bcmath.scale = 0
[Browscap]
[Session]
Session.save_handler = Files
Session.use_cookies = 1
Session.use_only_cookies = 1
Session.name = Phpsessid
Session.auto_start = 0
Session.cookie_lifetime = 0
Session.cookie_path =/
Session.cookie_domain =
Session.cookie_httponly =
Session.serialize_handler = PHP
session.gc_probability = 1
Session.gc_divisor = 1000
Session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
Session.bug_compat_warn = Off
Session.referer_check =
Session.cache_limiter = NoCache
Session.cache_expire = 180
Session.use_trans_sid = 0
session.hash_function = 0
Session.hash_bits_per_character = 5
Url_rewriter.tags = "A=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
Mssql.allow_persistent = On
Mssql.max_persistent =-1
Mssql.max_links =-1
Mssql.min_error_severity = 10
Mssql.min_message_severity = 10
Mssql.compatability_mode = Off
Mssql.secure_connection = Off
[Assertion]
[COM]
[Mbstring]
[GD]
[EXIF]
[Tidy]
Tidy.clean_output = Off
[SOAP]
Soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir= "/tmp"
soap.wsdl_cache_ttl=86400
Soap.wsdl_cache_limit = 5
[SYSVSHM]
[LDAP]
Ldap.max_links =-1
[MCrypt]
[DBA]
Extension = mongo.so
Extension = redis.so
Extension = memcache.so
Extension = igbinary.so
php-fpm
[Email protected] ~]# cat/usr/local/php/etc/php-fpm.conf
[Global]
PID = Run/php-fpm.pid
[WWW]
user = www
Group = www
Listen = 127.0.0.1:9000
PM = dynamic
Pm.max_children = 5
Pm.start_servers = 2
Pm.min_spare_servers = 1
Pm.max_spare_servers = 3
redis.conf
[Email protected] ~]# cat/usr/local/redis/redis.conf |grep-v "^#"
Daemonize Yes
Pidfile/var/run/redis.pid
Port 6379
Bind 127.0.0.1
Timeout 0
Tcp-keepalive 0
LogLevel Notice
Logfile/data/log/redis.log
Databases 16
Save 900 1
Save 300 10
Save 60 10000
Stop-writes-on-bgsave-error Yes
Rdbcompression Yes
Rdbchecksum Yes
Dbfilename Dump.rdb
Dir./
Slave-serve-stale-data Yes
Slave-read-only Yes
Repl-disable-tcp-nodelay No
Slave-priority 100
AppendOnly No
Appendfsync everysec
No-appendfsync-on-rewrite No
Auto-aof-rewrite-percentage 100
Auto-aof-rewrite-min-size 64MB
Lua-time-limit 5000
Slowlog-log-slower-than 10000
Slowlog-max-len 128
Hash-max-ziplist-entries 512
Hash-max-ziplist-value 64
List-max-ziplist-entries 512
List-max-ziplist-value 64
Set-max-intset-entries 512
Zset-max-ziplist-entries 128
Zset-max-ziplist-value 64
activerehashing Yes
Client-output-buffer-limit Normal 0 0 0
Client-output-buffer-limit slave 256MB 64MB 60
Client-output-buffer-limit pubsub 32MB 8MB 60
Hz 10
System
[[Email protected] ~] #vi/etc/security/limits.conf
* Soft Nofile 102400
* Hard Nofile 102400
command [[email protected] ~] #ulimit-N 102400
[[Email protected] ~] #vi/etc/sysctl.conf "At the end of this section, append the following configuration"
Net.ipv4.tcp_max_tw_buckets = 6000
Net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
Net.ipv4.tcp_rmem = 4096 87380 4194304
Net.ipv4.tcp_wmem = 4096 16384 4194304
Net.core.wmem_default = 8388608
Net.core.rmem_default = 8388608
Net.core.rmem_max = 16777216
Net.core.wmem_max = 16777216
Net.core.netdev_max_backlog = 262144
Net.core.somaxconn = 262144
Net.ipv4.tcp_max_orphans = 3276800
Net.ipv4.tcp_max_syn_backlog = 262144
Net.ipv4.tcp_timestamps = 0
Net.ipv4.tcp_synack_retries = 1
Net.ipv4.tcp_syn_retries = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_mem = 94500000 915000000 927000000
Net.ipv4.tcp_fin_timeout = 1
Net.ipv4.tcp_keepalive_time = 30
Net.ipv4.ip_local_port_range = 1024 65000
[[Email protected] ~] #sysctl-P Refresh
Three. Optimize profile [[email protected] ~] #vi/etc/my.conf[[email protected] ~] #vi ..../nginx.conf[[email protected] ~]# vi .../php-fpm . Conf[[email protected] ~] #vi ..../php.ini[[email protected] ~] #vi ..../redis.conf
LNMP configuration information 8 core 4g optimization