月度归档:2018年08月

Yii2 设置title

Controller:
public funtion actionIndex() {
        $this->getView()->title = "your title";
        return $this->render('index');
}

View:
<title><?= Html::encode($this->title) ?></title>

0

Centos7.4 Nginx命令行操作

/usr/local/nginx/sbin/nginx         #启动nginx
/usr/local/nginx/sbin/nginx -t      #检测配置文件是否正确
/usr/local/nginx/sbin/nginx -V      #查看版本

/usr/local/nginx/sbin/nginx -s stop #关闭服务
kill -s SIGTERM <nginx master pid>或kill -s SIGINT <nginx master pid> #关闭服务2

/usr/local/nginx/sbin/nginx -s quit #优雅地关闭
kill -s SIGQUIT <nginx master pid>  #优雅关闭2
kill -s SIGWINCH <nginx worker pid> #优雅地关闭某个worker进程

/usr/local/nginx/sbin/nginx -s reload #重新读取配置文件并生效
kill -s SIGHUP <nignx master pid> #效果同上

/usr/local/nginx/sbin/nginx -s reopen #日志文件回滚
kill -s SIGUSR1 <nginx master pid> #同上
0

Centos7.4安装python3.5.2

下载安装压缩包: wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

yum install openssl
yum install openssl-devel #安装openssl,否则pip可能不能用

tar -zxvf Python-3.5.2.tgz                      #解压
cd Python-3.5.2                                 #进入解压目录
mkdir /usr/local/python3.5.2                    #创建安装目录 
./configure --prefix=/usr/local/python3.5.2     #编译 
make&&make install                              #安装
mv /usr/bin/python /usr/bin/python_2.7.5        #备份原有python
ln -s /usr/local/python3.5.2/bin/python3.5.2 /usr/bin/python  #创建软连接
python -V
Python 3.5.2
修改yum配置文件,将python版本指向以前的旧版本
# vi /usr/bin/yum
# !/usr/bin/python2.7.5

修改urlgrabber-ext-down文件,更改python版本

# vi /usr/libexec/urlgrabber-ext-down
# !/usr/bin/python2.7.5

否则yum命令会报错

0