=Start=
缘由:
搭建VPS不仅仅是为了要有一个Linux环境进行学习、测试,最好还能安装PHP、Nginx、MySQL等环境方便搭建网站用来记录和分享所学内容。
正文:
# PHP sudo rpm -Uvh http: //dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo rpm -Uvh http: //rpms.famillecollet.com/enterprise/remi-release-7.rpm sudo vim /etc/yum.repos.d/remi.repo [remi] ...... enabled = 1 [remi-php56] ...... enabled = 1 yum list | grep php sudo yum install php php-devel php-mbstring php-mcrypt php-mysqlnd php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common php-imap php-xmlrpc php-soap php-snmp php-ldap php-opcache php-phpunit-PHPUnit php-pecl-apcu php-pecl-xdebug php-pecl-xhprof php-pecl-xmldiff-devel php56-runtime php56-build # Nginx(也可以选择自行编译安装) sudo rpm -Uvh http: //nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm sudo yum install nginx nginx-module-xslt nginx-module-perl nginx-module-image-filter nginx-mod-http-geoip sudo systemctl status nginx sudo systemctl start nginx curl http: //localhost:80/ # MySQL sudo yum install http: //www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm yum info Percona-Server-client- 56 Percona-Server-server- 56 Percona-Server-devel- 56 sudo yum install Percona-Server-client- 56 Percona-Server-server- 56 Percona-Server-devel- 56 sudo systemctl status mysql sudo systemctl start mysql sudo /usr/bin/mysql_secure_installation |
参考链接:
- https://blog.kuoruan.com/69.html
- https://www.ifshow.com/the-new-centos-7-install-lnmp-linux-nginx-mariadb-php-and-multi-site-configuration/
- https://wanglu.info/931.html
- https://blog.itnmg.net/centos-7-lnmp-ftp/
- http://www.dbaguo.com/2015/02/09/centos-7%E6%90%AD%E5%BB%BA%E5%9F%BA%E4%BA%8Elnmp%E7%9A%84wordpress/
- https://www.percona.com/doc/percona-server/5.6/installation/yum_repo.html
- https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7
=END=
《 “CentOS 7 设置-Step3.在 CentOS 7 上安装 LNMP” 》 有 7 条评论
Nginx Google 扩展
https://github.com/cuber/ngx_http_google_filter_module/blob/master/README.zh-CN.md#从发行版迁移
丛源码开始构建 ngx_pagespeed 扩展
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
为 CentOS7 上的 Nginx 启用 TCP Fast Open 功能
http://www.masv.io/enabling-tcp-fast-open-nginx-centos-7/
Let’s Encrypt,免费好用的 HTTPS 证书
https://imququ.com/post/letsencrypt-certificate.html
# 本打算在测试的时候就用上 Let’s Encrypt 的 HTTPS 证书的,后来发现,现在不支持为 IP 发 HTTPS 证书
https://github.com/ebekker/ACMESharp/issues/94
为nginx配置https并自签名证书
http://blog.creke.net/762.html
使用OpenSSL自签发服务器https证书
http://blog.creke.net/736.html
php.ini安全配置(A php.ini scanner for best security practices)
https://github.com/psecio/iniscan
https://github.com/perusio/php-ini-cleanup
在CentOS上安装PHP 7
==
PHP源码下载
http://php.net/downloads.php
为 WordPress 编译安装 PHP 7.0.3 亲测全攻略
https://www.bokeyy.com/post/build-php-7-0-3-for-wordpress.html
让PHP7达到最高性能的几个Tips
http://www.laruence.com/2015/12/04/3086.html
PHP7.0正式版编译安装升级及WordPress问题解决分享
https://zhangge.net/5075.html
Install PHP 7 on CentOS, RHEL or Fedora
https://blog.remirepo.net/post/2016/02/14/Install-PHP-7-on-CentOS-RHEL-Fedora
==
`$ sudo yum install php php-devel php-mbstring php-mcrypt php-mysqlnd php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common php-imap php-xmlrpc php-soap php-snmp php-ldap php-opcache php-phpunit-PHPUnit php-pecl-apcu php-pecl-xdebug php-pecl-xmldiff-devel
`
为处于后端的WordPress传递正确的用户IP
https://enginx.cn/2017/01/22/%E4%B8%BA%E5%A4%84%E4%BA%8E%E5%90%8E%E7%AB%AF%E7%9A%84wordpress%E4%BC%A0%E9%80%92%E6%AD%A3%E7%A1%AE%E7%9A%84%E7%94%A8%E6%88%B7ip.html
因为VPS上的MySQL服务出现过停止导致WordPress无法正常工作的情况,所以用crontab增加一个停止检测重启MySQLd功能的任务,防止博客挂太久
`
#!/bin/bash
# Date: 20170220
# set -x
# */2 * * * * /bin/bash /root/restart_mysqld.sh
export PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin/:/usr/local/sbin
function func_restart_mysqld() {
sudo systemctl status mysqld
if [[ $? -ne 0 ]]; then
sudo systemctl start mysqld
fi
}
function func_main() {
func_restart_mysqld
}
func_main
`
How to Install Latest MySQL 5.7.9 on RHEL/CentOS 7/6/5 and Fedora 23/22/21
https://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/
https://www.percona.com/blog/2016/05/18/where-is-the-mysql-5-7-root-password/
`
Note: MySQL version 5.7 or higher generates a temporary random password in /var/log/mysqld.log after installation.
# grep ‘temporary password’ /var/log/mysqld.log
# mysql_secure_installation
`
攻击LNMP架构Web应用的几个小Tricks
https://www.leavesongs.com/PENETRATION/some-tricks-of-attacking-lnmp-web-application.html