Ubuntu 18.04的ssh版本中,root用户默认被禁止连接
需要编辑 /etc/ssh/sshd_config 文件
sudo vi /etc/ssh/sshd_config
找到PermitRootLogin,设为yes
PermitRootLogin yes
重启ssh服务
sudo systemctl restart ssh
Ubuntu 18.04的ssh版本中,root用户默认被禁止连接
需要编辑 /etc/ssh/sshd_config 文件
sudo vi /etc/ssh/sshd_config
找到PermitRootLogin,设为yes
PermitRootLogin yes
重启ssh服务
sudo systemctl restart ssh
php-fpm 配置名称视具体版本而定
sudo vi /etc/php/7.2/fpm/php.ini
找到以下两项,修改为自己想要的值,比如50M
post_max_size = 50M
upload_max_filesize = 50M
sudo systemctl restart php7.2-fpm
sudo systemctl restart nginx
关于内核版本的定义:
版本性质:主分支ml(mainline),稳定版(stable),长期维护版lt(longterm)
版本命名格式为 “A.B.C”:
数字 A 是内核版本号:版本号只有在代码和内核的概念有重大改变的时候才会改变,历史上有两次变化:
数字 B 是内核主版本号:主版本号根据传统的奇-偶系统版本编号来分配:奇数为开发版,偶数为稳定版
数字 C 是内核次版本号:次版本号是无论在内核增加安全补丁、修复bug、实现新的特性或者驱动时都会改变
uname -r
3.10.0-514.el7.x86_64
升级内核需要先导入elrepo的key,然后安装elrepo的yum源:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install -y https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
如果要安装ml内核,使用如下命令:
yum --enablerepo=elrepo-kernel -y install kernel-ml-devel kernel-ml
如果要安装lt内核,使用如下命令:
yum --enablerepo=elrepo-kernel -y install kernel-lt-devel kernel-lt
grub2-set-default 0 grub2-mkconfig -o /boot/grub2/grub.cfg
查看已安装的内核
rpm -qa | grep kernel
删除旧内核
yum remove 内核名称
移除旧版本
yum remove kernel-tools-libs kernel-tools -y
安装新版本
如果安装ml版本执行:
yum --disablerepo=* --enablerepo=elrepo-kernel install kernel-ml-tools
如果安装lt版本执行:
yum --disablerepo=* --enablerepo=elrepo-kernel install kernel-lt-tools
reboot
重启机器,然后查看内核版本uname -r
5.3.8-1.el7.elrepo.x86_64
Google 开源了其 TCP BBR 拥塞控制算法,并提交到了 Linux 内核,从 4.9 开始,Linux 内核已经用上了该算法。根据以往的传统,Google 总是先在自家的生产环境上线运用后,才会将代码开源,此次也不例外。 根据实地测试,在部署了最新版内核并开启了 TCP BBR 的机器上,网速甚至可以提升好几个数量级。
运行 lsmod | grep bbr,如果结果中没有tcp_bbr,则先运行:
modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
运行:
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
运行:
sysctl -p
保存生效。运行:
sysctl net.ipv4.tcp_available_congestion_control sysctl net.ipv4.tcp_congestion_control
若均有bbr,则开启BBR成功。
PHP(外文名:PHP: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域。PHP 独特的语法混合了C、Java、Perl以及PHP自创的语法。它可以比CGI或者Perl更快速地执行动态网页。用PHP做出的动态页面与其他的编程语言相比,PHP是将程序嵌入到HTML(标准通用标记语言下的一个应用)文档中去执行,执行效率比完全生成HTML标记的CGI要高许多;PHP还可以执行编译后代码,编译可以达到加密和优化代码运行,使代码运行更快。
yum源不存在php7.x,我们可以通过源码方式安装php7.x。
1、准备编译环境
yum -y install autoconf gcc bzip2 bzip2-devel libpng libpng-devel freetype-devel gmp-devel readline-devel curl-devel libxml2-devel libjpeg-devel bison openssl-devel
以及 libzip
2、下载并解压
wget https://www.php.net/distributions/php-7.3.24.tar.bz2 \ && tar -jxf php-7.3.24.tar.bz2 \ && cd php-7.3.24
3、配置并构建 PHP。在此步骤您可以使用很多选项自定义 PHP,例如启用某些扩展等。 运行 ./configure –help 命令来获得完整的可用选项清单。 在本示例中,我们仅进行包含 PHP-FPM 和 MySQL 支持的简单配置。
./configure --prefix=/usr \ --sysconfdir=/etc/php \ --with-config-file-path=/etc/php \ --with-config-file-scan-dir=/etc/php/php.d \ --bindir=/usr/bin \ --docdir=/usr/share/doc \ --sbindir=/usr/sbin \ --libdir=/usr/lib64/php \ --with-libdir=/usr/lib64/php \ --libexecdir=/usr/libexec \ --localstatedir=/var \ --runstatedir=/run \ --includedir=/usr/include \ --localedir=/usr/local \ --datarootdir=/usr/share \ --datadir=/usr/share/php \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --enable-fpm \ --with-fpm-user=www-data \ --with-fpm-group=www-data \ --enable-mysqlnd \ --enable-mysqlnd-compression-support \ --enable-json \ --with-openssl-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib-dir \ --with-freetype-dir \ --enable-gd-jis-conv \ --enable-ftp \ --enable-filter \ --enable-fileinfo \ --with-curl \ --with-iconv \ --with-bz2 \ --with-zlib \ --with-pcre-regex \ --with-openssl \ --enable-dom \ --with-gettext \ --with-mysqli=mysqlnd \ --enable-pdo \ --with-pdo-mysql=mysqlnd \ --with-pdo-sqlite \ --enable-simplexml \ --enable-session \ --enable-sysvsem \ --enable-sysvmsg \ --enable-sockets \ --with-libxml-dir \ --with-pear \ --enable-opcache \ --with-xmlrpc \ --with-mhash \ --with-sqlite3 \ --enable-bcmath \ --with-cdb \ --enable-exif \ --with-gd \ --with-gmp \ --enable-mbstring \ --enable-mbregex \ --enable-mbregex-backtrack \ --with-onig \ --with-readline \ --enable-shmop \ --enable-zip \ && make \ && sudo make install
4、创建配置文件,并将其复制到正确的位置。
cp php.ini-production /etc/php/php.ini \ && cp sapi/fpm/php-fpm.conf /etc/php/php-fpm.conf \ && cp sapi/fpm/www.conf /etc/php/php-fpm.d/www.conf \ && cp sapi/fpm/php-fpm.service /etc/systemd/system/php-fpm.service
5、需要着重提醒的是,如果文件不存在,则阻止 Nginx 将请求发送到后端的 PHP-FPM 模块, 以避免遭受恶意脚本注入的攻击。
将 php.ini 文件中的配置项 cgi.fix_pathinfo 设置为 0 。
打开 php.ini:
vim /etc/php/php.ini
定位到 cgi.fix_pathinfo= 并将其修改为如下所示:
cgi.fix_pathinfo=0
6、配置 php-fpm 服务
sudo systemctl start php-fpm
检查是否启动成功
sudo systemctl status php-fpm
如果出现错误:ERROR: [pool www] cannot get uid for user 'www-data'
则新建www-data 用户组:
groupadd -r www-data useradd -g www-data -s /sbin/nologin -M -r www-data
设置服务自启动
sudo systemctl enable php-fpm
本文档未涵盖对 php-fpm 进行进一步配置的信息,如果您需要更多信息,请查阅相关文档。
在计算机网络上,OpenSSL是一个开放源代码的软件库包,应用程序可以使用这个包来进行安全通信,避免窃听,同时确认另一端连接者的身份。这个包广泛被应用在互联网的网页服务器上。
1、准备编译环境
yum install gcc
2、下载OpenSSL源码
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz
3、解压
tar -xzf OpenSSL_1_1_1c.tar.gz
4、配置
cd openssl-OpenSSL_1_1_1c ./config --prefix=/usr
5、编译&&安装
make && make install ldconfig
7、查看安装版本
openssl version
OpenSSL 1.1.1c 28 May 2019