lnmp配置信息 8核4g优化

MYSQL   my.conf
# The following options will 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 be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will 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 is not set
# but will not function as a master if omitted
server-id       = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <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 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 will create a master.info file, and any later
#    change in this file to the variables‘ values below will 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 that reason, you may 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 will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will 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 are 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 25 % 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 are not 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

系统

[[email protected] ~]#vi /etc/security/limits.conf
* soft nofile 102400
* hard nofile 102400
命令  [[email protected] ~]#ulimit -n  102400

[[email protected] ~]#vi /etc/sysctl.conf     “末尾追加下面的这段配置”
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  刷新

三。优化配置文件

[[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

时间: 2025-01-05 06:00:49

lnmp配置信息 8核4g优化的相关文章

Mysql 配置参数详解以及优化配置

mysql有以下几种日志: 错误日志:   log-err 查询日志:   log 慢查询日志:  log-slow-queries 更新日志:   log-update 二进制日志: log-bin 要把日志生成在 /var/log 目录下(是系统日志存放的地方,只有 root 账号有写权限),需要 MySQL进程对这个目录有读写权限,一般是不这么做的,也考虑到安全问题,包括 MySQL 本身的数据安全,因为对 MySQL 的所有操作,都会记录到常规查询日志.MySQL的日志就不要用 /var

英特尔&#174; 至强融核? 处理器优化教程

原文链接  下载文件 1. 简介 本教程将介绍多种优化应用,以支持其在英特尔? 至强融核? 处理器上运行. 本教程中的优化流程分为三个部分: 第一部分介绍用于对代码进行矢量化(数据并行化)处理的通用优化技巧. 第二部分介绍如何添加线程层并行化,以充分利用处理器中的所有可用内核. 第三部分将通过在英特尔至强融核处理器上启用内存优化,以优化代码. 最后的结论部分将通过图表方式展示各优化步骤所实现的性能提升. 优化过程如下:以串行.性能有待提升的示例代码为基础. 然后采用优化技巧处理该代码,获得矢量化

教你如何利用分布式的思想处理集群的参数配置信息——spring的configurer妙用

引言 最近LZ的技术博文数量直线下降,实在是非常抱歉,之前LZ曾信誓旦旦的说一定要把<深入理解计算机系统>写完,现在看来,LZ似乎是在打自己脸了.尽管LZ内心一直没放弃,但从现状来看,需要等LZ的PM做的比较稳定,时间慢慢空闲出来的时候才有机会看了.短时间内,还是要以解决实际问题为主,而不是增加自己其它方面的实力. 因此,本着解决实际问题的目的,LZ就研究出一种解决当下问题的方案,可能文章的标题看起来挺牛B的,其实LZ就是简单的利用了一下分布式的思想,以及spring框架的特性,解决了当下的参

前端获得session信息方式对比,优化

在开发中,页面 js 经常会遇到需要 当前登录用户信息(菜单权限,用户基本信息,配置信息) 的地方,一般情况我们可能对这些信息获取方式不是太在意,但是现在的前端通过webpack打包,即使做了代码分割,js文件,css文件还是很大. 在首次加载的情况下面,存在一定的优化空间.下面主要介绍一些信息获取的方式.      接口使用的是模拟数据,session获取接口设置成了1秒延时,下面的数据都是首次加载的数据,不考虑304的情况. 1.后端程序设置,直接js代码,全局变量写入方式 浏览器访问app

Linux查看CPU和内存的配置信息

CPU配置信息:[email protected]:~/test/python$ cat /proc/cpuinfo processor : 0 #系统中逻辑处理核的编号 vendor_id : GenuineIntel #CPU制造商 cpu family : 6 #CPU产品系列代号 model : 79 #CPU属于其系列中的哪一代的代号 model name : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz #CPU属于的名字及其编号.标称主频 st

品尝阿里云容器服务:5个2核4G节点使用情况记载

使用5台2核4G非IO优化的ECS作为节点创建集群,节点操作系统是Ubuntu 16.04.2 LTS.创建后3个为mananger节点,2个为worker节点,每个节点默认会运行7个容器,其中3个system容器: acs-agent acsvolumedriver_volumedriver tunnel-agent 4个default容器: acslogging_logspout acslogging_logtail acsmonitoring_acs-monitoring-agent,ac

session的官方定义是:Session:在计算机中,尤其是在网络应用中,称为“会话控制”。Session 对象存储特定用户会话所需的属性及配置信息。 说白了session就是一种可以维持服务器端的数据存储技术。session主要有以下的这些特点: 1. session保存的位置是在服务器端 2. session一般来说是要配合cookie使用,如果是浏览器禁用了cookie功

session的官方定义是:Session:在计算机中,尤其是在网络应用中,称为"会话控制".Session 对象存储特定用户会话所需的属性及配置信息. 说白了session就是一种可以维持服务器端的数据存储技术.session主要有以下的这些特点: 1. session保存的位置是在服务器端 2. session一般来说是要配合cookie使用,如果是浏览器禁用了cookie功能,也就只能够使用URL重写来实现session存储的功能 3. 单纯的使用session来维持用户状态的话

伪基站,卒于5G——本质上是基于网络和UE辅助的伪基站检测,就是将相邻基站的CI、信号强度等信息通过测量报告上报给网络,网络结合网络拓扑、配置信息等相关数据,对所有数据进行综合分析,确认在某个区域中是否存在伪基站

伪基站,卒于5G from:https://www.huxiu.com/article/251252.html?h_s=h8 2018-07-05 21:58收藏27评论6社交通讯 本文来自微信公众号:网优雇佣军(hr_opt),虎嗅获授权发表,题图来自:pixabay.com. 伪基站是2G时代的产物,通过伪装运营商的基站,向用户手机发送广告推销.诈骗.钓鱼网站等信息,侵犯公民隐私,危害人身财产安全,扰乱社会秩序. 2G时代,由于GSM只有单向鉴权加密,手机无法确认网络的合法性,导致伪基站有机

福利:阿里云2核4G服务器新用户三年最高699!!!一年只要269

活动地址:https://promotion.aliyun.com/ntms/act/vm/aliyun-group/buy.html?group=Ids6K1cIRw 难得的好活动 一.活动对象 1.阿里云官网注册的个人实名认证用户.其中,新老用户均可作为拼团活动的推荐者,但只有未购买过云产品(即账号下无付费订单记录)的新用户方有资格参与拼团购买. 2.同一用户仅有一次参与拼团推荐或拼团购买指定云服务器的机会.例如:同一用户使用不同账号作为推荐者参与本活动的,仅首个参与活动的账号可获赠:在阿里