lnmp-脚本

#!/bin/bash

#Script:Nginx_Script.sh

#Version:Release 1.0

#Author:766083824@qq.com

#Date:2017-4-2

#CentOS-7.3最小化

#Linux下去掉文件中^M的方法

#sed -i ‘s/\r//g’ filename

#关闭Selinux
setenforce 0 && sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config

#安装Nginx-1.6.3

#获取Nginx
soft_dir=/opt
inst_dir=/usr/local
log_dir=/data/wwwlogs
mkdir -pv $log_dir

cd $soft_dir

echo “start download wget vim bash-completion”
yum -y install wget vim bash-completion &> /dev/null
echo “wget vim bash-completion is done”

echo “start download Nginx”
wget -c http://nginx.org/download/nginx-1.6.3.tar.gz &> /dev/null
echo “Nginx download is done”

echo “start tar”
tar zxf nginx-1.6.3.tar.gz && cd nginx-1.6.3
echo “tar is done”

#创建程序用户
useradd -r -s /sbin/nologin www
echo $(id www)

#解决依赖环境
echo “start download pcre-devel openssl-devel gcc gcc-c++ per”
yum -y install pcre-devel openssl-devel gcc gcc-c++ per &> /dev/null
echo “pcre-devel openssl-devel gcc gcc-c++ per is done”

#编译并make安装
echo “start Nginx install”
./configure –prefix=/usr/local/nginx \
–user=www \
–group=www \
–with-http_ssl_module \
–with-http_gzip_static_module \
–with-http_gunzip_module \
–with-http_stub_status_module \
–with-pcre &> /dev/null && make &> /dev/null && make install &> /dev/null
echo “Nginx install is done”

#开机启动Nginx
echo “开机启动Nginx”
chmod +x /etc/rc.d/rc.local
/usr/local/nginx/sbin/nginx
echo “/usr/local/nginx/sbin/nginx” >> /etc/rc.local
echo “开机启动Nginx is done”

#放行80端口
echo “放行80端口”
iptables -I INPUT -p tcp –dport 80 -j ACCEPT
service iptables save
service iptables restart

#firewall-cmd –zone=public –add-port=80/tcp –permanent

#systemctl stop firewalld

#systemctl start firewalld

#安装cmake 3.7.2
cd $soft_dir
yum -y install ncurses-devel
wget -c https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
tar zxf cmake-3.7.2.tar.gz && cd cmake-3.7.2
./configure –prefix=/usr/local/cmake && gmake && gmake install
ln -sfv /usr/local/cmake/bin/* /usr/bin/

#安装boost_1_59_0.tar.gz
cd $soft_dir
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
cd /usr/local
cp /opt/boost_1_59_0.tar.gz /usr/local/
tar zxf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh && ./b2 install

#安装mysql-5.7.17.tar.gz
cd $soft_dir
wget -c https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.17.tar.gz
tar zxf mysql-5.7.17.tar.gz && cd mysql-5.7.17

#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/ -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost_1_59_0 &> /dev/null

cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost_1_59_0

#remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.

#find / -name CMakeCache.txt -exec rm -rf {} \; #全部删除后再重新cmake就OK了。该报错原因是未安装ncurses-devel yum -y install ncurses-devel

#出现:Build files have been written to: /opt/software/mysql-5.6.35执行如下命令:
make && make install

#创建程序用户
useradd -r -s /sbin/nologin mysql
echo $(id mysql)

#建立配置文件
cp -arp support-files/my-default.cnf /etc/my.cnf

#set my.cnf
mv /etc/my.cnf{,.back}
{
cat >> /etc/my.cnf << EOF
[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql
socket = /tmp/mysql.sock
pid-file = /data/mysql/localhost.localdomain.com.pid

#key_buffer = 16K
query_cache_limit = 256K
query_cache_size = 4M
max_allowed_packet = 1M
table_open_cache = 8
max_connections = 16

#thread_concurrency = 2
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

default-storage-engine = MyISAM
default-tmp-storage-engine = MYISAM
loose-skip-innodb

loose-innodb-trx = 0
loose-innodb-locks = 0
loose-innodb-lock-waits = 0
loose-innodb-cmp = 0
loose-innodb-cmp-per-index = 0
loose-innodb-cmp-per-index-reset = 0
loose-innodb-cmp-reset = 0
loose-innodb-cmpmem = 0
loose-innodb-cmpmem-reset = 0
loose-innodb-buffer-page = 0
loose-innodb-buffer-page-lru = 0
loose-innodb-buffer-pool-stats = 0
loose-innodb-metrics = 0
loose-innodb-ft-default-stopword = 0
loose-innodb-ft-deleted = 0
loose-innodb-ft-being-deleted = 0
loose-innodb-ft-config = 0
loose-innodb-ft-index-cache = 0
loose-innodb-ft-index-table = 0
loose-innodb-sys-tables = 0
loose-innodb-sys-tablestats = 0
loose-innodb-sys-indexes = 0
loose-innodb-sys-columns = 0
loose-innodb-sys-fields = 0
loose-innodb-sys-foreign = 0
loose-innodb-sys-foreign-cols = 0

slow_query_log = 1 #是否启用慢查询 1:启用 0:禁用
long_query_time = 1 #设置超过指定时间即为慢查询语句,单位是秒,建议2秒内
slow_query_log_file = “/data/mysql/wanggaoli.com.slow.log” #设置慢查询日志存放位置

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]

#key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
EOF
}

#初始化数据库
yum -y install autoconf &> /dev/null
mkdir -pv /data

#数据文件目录不应该有其他的文件,这个/data目录应该是一个空目录
/usr/local/mysql/bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql &> /dev/null

#设置环境变量
echo “PATH=$PATH:/opt/mysql/bin” >> /etc/profile
source /etc/profile
echo $PATH
chown -R mysql.mysql /data/mysql
chown -R mysql.mysql /usr/local/mysql

#添加系统服务

#/usr/bin/cp -arp support-files/mysql.server /etc/init.d/mysqld

#/usr/bin/chmod +x /etc/init.d/mysqld

#chkconfig mysqld on #开机自启
chmod +x /usr/local/mysql/support-files/mysql.server
echo “/usr/local/mysql/support-files/mysql.server start” >> /etc/rc.local
/usr/local/mysql/support-files/mysql.server start

#放行3306端口
echo “放行3306端口”
iptables -I INPUT -p tcp –dport 3306 -j ACCEPT
service iptables save
service iptables restart

#firewall-cmd –zone=public –add-port=3306/tcp –permanent

#systemctl stop firewalld

#systemctl start firewalld

#安装libmcrypt-2.5.8.tar.gz
echo “安装libmcrypt”
cd $soft_dir
wget -c https://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz &> /dev/null
tar zxf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure &> /dev/null && make &> /dev/null && make install &> /dev/null
ln -sfv /usr/local/lib/libmcrypt.la /usr/lib
ln -sfv /usr/local/lib/libmcrypt.so /usr/lib
ln -sfv /usr/local/lib/libmcrypt.so.4 /usr/lib
ln -sfv /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib
ln -sfv /usr/local/bin/libmcrypt-config /usr/lib

#安装mhash-0.9.9.9.tar.gz
echo “安装mhash-0.9.9.9.tar.gz”
cd $soft_dir
wget -c https://jaist.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz &> /dev/null
tar zxf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
./configure &> /dev/null && make &> /dev/null && make install &> /dev/null
ln -sfv /usr/local/lib/libmhash.a /usr/lib
ln -sfv /usr/local/lib/libmhash.la /usr/lib
ln -sfv /usr/local/lib/libmhash.so /usr/lib
ln -sfv /usr/local/lib/libmhash.so.2 /usr/lib
ln -sfv /usr/local/lib/libmhash.so.2.0.1 /usr/lib

#安装mcrypt-2.6.8.tar.gz
echo “安装mcrypt-2.6.8.tar.gz”
cd $soft_dir
wget -c https://jaist.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz &> /dev/null
tar zxf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8
./configure &> /dev/null && make &> /dev/null && make install &> /dev/null
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
./configure &> /dev/null && make &> /dev/null && make install &> /dev/null

#安装php-5.6.12.tar.gz
echo “安装依赖包libjpeg libjpeg-devel libpng libpng-devel ……”
yum -y install bzip2 bzip2-devel libxml2-devel openssl openssl-devel libcurl libcurl-devel libvpx libvpx-devel libjpeg-devel freetype-devel openldap openldap-devel readline-devel libpng-devel &> /dev/null
cp -frp /usr/lib64/libldap /usr/lib/
cp -frp /usr/lib64/libpng
/usr/lib/
ln -svf /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
ln -sfv /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so
cd $soft_dir
echo “安装php-5.6.30.tar.gz”
wget -c http://cn.php.net/distributions/php-5.6.12.tar.gz &> /dev/null
tar zxf php-5.6.12.tar.gz && cd php-5.6.12
echo “php-5.6.12——config……”
./configure \
–prefix=/usr/local/php5612 \
–with-config-file-path=/usr/local/php5612/etc \
–with-mcrypt \
–with-mhash \
–with-mysql \
–with-mysqli \
–with-mysql-sock \
–with-pdo-mysql=mysqlnd \
–with-gd \
–with-iconv \
–with-zlib \
–with-curl \
–with-jpeg-dir \
–with-freetype-dir \
–with-openssl \
–with-xmlrpc \
–with-bz2 \
–with-gettext \
–with-readline \
–with-ldap \
–with-fpm-user=www \
–with-fpm-group=www \
–enable-fpm \
–enable-cgi \
–enable-xml \
–enable-bcmath \
–enable-inline-optimization \
–enable-mbregex \
–enable-mbstring \
–enable-ftp \
–enable-gd-native-ttf \
–enable-pcntl \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvshm \
–enable-shmop \
–enable-zip \
–enable-soap \
–enable-session \
–enable-opcache \
–enable-cli \
–enable-mbstring &> /dev/null
echo “php-5.6.12——编译……”
make ZEND_EXTRA_LIBS=’-llber’ &> /dev/null && make install &> /dev/null
echo “php-5.6.12——配置”
cp php.ini-development /usr/local/php5612/etc/php.ini
cp /usr/local/php5612/etc/php-fpm.conf.default /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/short_open_tag \= Off/short_open_tag \= On/‘ /usr/local/php5612/etc/php.ini
sed -i ‘s/\;date.timezone \=/date.timezone \= Asia\/Shanghai/‘ /usr/local/php5612/etc/php.ini
echo “/usr/local/php5612/sbin/php-fpm” >> /etc/rc.local
/usr/local/php5612/sbin/php-fpm

echo “fastcgi配置及优化”
mkdir -pv /usr/local/nginx/conf/vhost
mkdir -pv /data/wwwroot/www.wanggaoli.com

mv /usr/local/nginx/conf/nginx.conf{,.back}

{
cat >> /usr/local/nginx/conf/nginx.conf << EOF

#user nobody;
user www;
worker_processes auto;
worker_cpu_affinity 00000001;
worker_rlimit_nofile 65535;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
use epoll;
multi_accept on;
worker_connections 2048;
}

http {
include mime.types;
include vhost/*.conf;
default_type application/octet-stream;
server_tokens off; #关闭版本号
sendfile on;
tcp_nopush on;

#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;keepalive_timeout  65;tcp_nodelay on;client_header_timeout 15;client_body_timeout 15;send_timeout 15;client_max_body_size 10m;client_header_buffer_size 4k;open_file_cache max=102400 inactive=20s;open_file_cache_valid 30s;open_file_cache_min_uses 1;gzip  on;gzip_min_length   1k;     #大于1K才压缩gzip_buffers    4 16k;   #压缩缓存区大小gzip_http_version  1.1;gzip_comp_level  5;       #压缩比率 1-9,越大压缩越好,消耗资源越大gzip_vary on;             #vary  header支持gzip_types text/plain application/x-javascript text/css application/xml; #压缩类型,不同版本,类型不一样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 128k;

fastcgi_cache /opt/nginx/cache_fastcgi;

fastcgi_cache_valid 200 302 1h;fastcgi_cache_valid 301 1d;fastcgi_cache_valid any 1m;fastcgi_cache_min_uses 1;

server {

listen 80;

server_name localhost;

    #charset koi8-r;    #access_log  logs/host.access.log  main;

location / {

root html;

index index.html index.htm;

}

    #error_page  404              /404.html;    # redirect server error pages to the static page /50x.html    #

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80    #    #location ~ \.php$ {    #    proxy_pass   http://127.0.0.1;    #}    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000    #    #location ~ \.php$ {    #    root           html;    #    fastcgi_pass   127.0.0.1:9000;    #    fastcgi_index  index.php;    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;    #    include        fastcgi_params;    #}    # deny access to .htaccess files, if Apache's document root    # concurs with nginx's one    #    #location ~ /\.ht {    #    deny  all;    #}

}

# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}

}
EOF
}

{
cat >> /usr/local/nginx/conf/vhost/www.wanggaoli.com.conf << EOF
server {
listen 80;

#server_name www.wanggaoli.com;
server_name localhost;

location / {
root /data/wwwroot/www.wanggaoli.com;
index index.php index.htm index.html;
}

location /status {
stub_status on;
access_log off;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

location ~(robots.txt|localimage.png) { #为robots.txt 为7天并不记录404
log_not_found off;
expires 7d;
break;
}

location ~ .(gif|jpg|jpeg|png|bmp|swf)$ {

expires 30d;

}

location ~ .(js|css)$ {

expires 30d;

}

location ~ .php$ {
root /data/wwwroot/www.wanggaoli.com/;

#fastcgi_pass 127.0.0.1:9000;fastcgi_pass unix:/dev/shm/php-cgi.sock;fastcgi_index index.php;include fastcgi.conf;#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;fastcgi_cache_use_stale error timeout invalid_header http_500;fastcgi_cache_key $request_method://$host$request_uri;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 128k;

fastcgi_cache cache_fastcgi;

fastcgi_cache_valid 200 302 1h;fastcgi_cache_valid 301 1d;fastcgi_cache_valid any 1m;fastcgi_cache_min_uses 1;

}

}
EOF
}

sed -i ‘s/\;pid \= run\/php-fpm.pid/pid \= \/usr\/local\/php5612\/var\/run\/php-fpm.pid/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;error_log \= log\/php-fpm.log/error_log \= \/usr\/local\/php5612\/var\/log\/php-fpm.log/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;log_level \= notice/log_level \= notice/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;rlimit_files \= 1024/rlimit_files \= 2048/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;events.mechanism \= epoll/events.mechanism \= epoll/‘ /usr/local/php5612/etc/php-fpm.conf

#sed -i ‘s/user = www

#sed -i ‘s/group = www
sed -i ‘s/listen \= 127.0.0.1\:9000/listen \= \/dev\/shm\/php-cgi.sock/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;listen.backlog \= 65535/listen.backlog \= 65535/‘ /usr/local/php5612/etc/php-fpm.conf

#sed -i ‘s/pm = dynamic
sed -i ‘s/pm.max_children \= 5/pm.max_children \= 15/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/pm.start_servers \= 2/pm.start_servers \= 5/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/pm.min_spare_servers \= 1/pm.min_spare_servers \= 5/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/pm.max_spare_servers \= 3/pm.max_spare_servers \= 15/‘ /usr/local/php5612/etc/php-fpm.conf
sed -i ‘s/\;pm.max_requests \= 500/pm.max_requests \= 1024/‘ /usr/local/php5612/etc/php-fpm.conf
echo “chown www.www /dev/shm/php-cgi.sock” >> /etc/rc.local

kill -9 cat /usr/local/php5612/var/run/php-fpm.pid
/usr/local/php5612/sbin/php-fpm
chown www.www /dev/shm/php-cgi.sock
/usr/local/nginx/sbin/nginx -s reload

#phpinfo()
{
cat >> /data/wwwroot/www.wanggaoli.com/index.php << EOF
<?php
phpinfo();
?>
EOF
}

echo “一键sock”

set ulimit

limit()
{
echo “ulimit -SHn 65535” >>/etc/rc.local
cat >> /etc/security/limits.conf << EOF

  • soft nofile 65535
  • hard nofile 65535
    EOF
    }

set sysctl

sysctl()
{
cp /etc/sysctl.conf /etc/sysctl.conf-$(date +%F).bak
true > /etc/sysctl.conf
cat >> /etc/sysctl.conf << EOF
kernel.core_uses_pid = 1
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
kernel.sysrq = 0
net.core.netdev_max_backlog = 262144
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.somaxconn = 2048
net.core.wmem_default = 8388608
net.core.wmem_max = 16777216
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.icmp_echo_ignore_all = 1 #禁ping,如果有nagios监控,这步可省去
net.ipv4.ip_forward = 0
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_sack = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
EOF
/sbin/sysctl -p
echo “sysctl set OK!!”
}

#—————————————————————————–
limit
sysctl -p

#reboot
 

版权声明:
作者:WangGaoli
链接:https://wanggaoli.com/2812.html
来源:王高利的个人博客
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>