将 CentOS 7 中的 firewalld 换回 iptables

惯例是一段废话


前几天开始把各服务器从 Ubuntu 迁移到了 CentOS,然而在配置 iptables 的时候发现表好像不太对劲,Google 后得知原来 CentOS 7 中默认的防火墙从 iptables 换成了 firewalld,然而懒人如我 = = 所以还是先换回 iptables 以当权宜之计

Reverting to the iptables Service


If you are not ready to make the break to firewalld, you can still use the iptables service by issuing the following commands.

systemctl stop firewalld
systemctl disable firewalld

yum install iptables-services

iptables-service

touch /etc/sysconfig/iptables
systemctl start iptables
systemctl enable iptables

touch /etc/sysconfig/ip6tables
systemctl start ip6tables
systemctl enable ip6table

平滑过渡到 PHP 7

(本文假设你在使用 Debian 系操作系统,如 Debian,Ubuntu 等,本文实际操作环境为 Ubuntu 14.04.3 LTS)

安装 PHP 7

假如您曾使用过 HHVM 或者 PHP 5,您可以考虑先将其卸载

sudo apt-get purge php5*
sudo apt-get purge hhvm*

卸载过后正式开始安装

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0-fpm
sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-curl
sudo apt-get install php7.0-dev
sudo apt-get install php7.0-mbstring

你以为还有很多步骤?不好意思,PHP 7 的安装到此为止了 – – 就这么简单。

重新配置 Nginx

对于 HHVM 用户,请先把 Nginx 配置中的 include hhvm.conf 去掉

然后加入以下字段

        location ~ \.php$ {
                try_files $uri =404;
                include fastcgi.conf;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

最后的步骤

最后没啥好说的,无非就是重启 PHP-FPM 还有重载 Nginx 而已

sudo /etc/init.d/php7.0-fpm restart
sudo nginx -s reload

Enjoy!

 

全站开启 HTTPS 访问

嘛,说来刚开 Blog 的时候就打算买一个域名然后加个证书。

正好上周某良心 JS 开了个便利店(指的就是 @showfom 啦啊哈哈

WildCard 还打折,域名价格也相当良心啊 – –

于是劳伦斯咬紧牙关,掏出了 80 大洋(心疼啊)氪了一域名还有一野卡(

hola,你们现在访问 winooxx.tk 还是 lawrencexs.xyz 都会跳转到 https://lawrencexs.xyz 啦 23333

晚点整理过后就发一份 SSL Lab 评分为 A+ 的 Nginx 配置