How to Install PHP 5.4, PHP 5.5 or PHP 5.6 on CentOS 6

Posted Leave a commentPosted in Skill

Install EPEL and Remi Repository 1. To install latest stable version of PHP, you need to add EPEL and Remi repository to your CentOS 6distribution using the following commands as root user. # wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm # rpm -Uvh epel-release-6-8.noarch.rpm remi-release-6.rpm Install EPEL and Remi Repo Install Yum-Utils to Manage Repository 2. Install yum-utils, a collection of utilities that integrate with […]

Installing PHP 5.4 on RHEL 6 and CentOS 6

Posted Leave a commentPosted in Skill

Red Hat Enterprise Linux and CentOS 6 still ship with PHP 5.3. ownCloud requires PHP 5.4 or better. There are several third-party repositories that supply PHP 5.4, but you must use the Software Collections (SCL) repository to be in compliance with your RHEL support contract, and not any other third-party repository. RHEL 6 Follow these […]

How to fix wordpress on Nginx 404 not found page

Posted Leave a commentPosted in Skill

Please add following text into nginx configuration file. location / { # This is cool because no php is touched for static content. # include the “?$args” part so non-default permalinks doesn’t break when using query string try_files $uri $uri/ /index.php?$is_args$args =404; } if (!-e $request_filename) { rewrite ^.*$ /index.php last; }  

How to fix 404 not found in Nginx of WordPress website

Posted Leave a commentPosted in Skill

how to fix ? it’s a really simple issues, just use rewrite function could be fix it. the code will be like this. location / { index index.html index.php; if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } } rewrite /wp-admin$ $scheme://$host$uri/ […]

快速搭建 Nginx + https + wordpress + Let’s Encrypt永久免费SSL证书

Posted Leave a commentPosted in Skill

首先准备一台Google cloud server, CentOS 6.1 安装必要软件 sudo yum -y install nginx php php-mysql mysql mysql-server git php-fpm php-xml php-mbstring 启动相关软件 sudo chkconfig mysqld on sudo service mysqld start sudo chkconfig nginx on sudo service nginx start sudo service php-fpm start sudo chkconfig php-fpm on 此时在浏览器输入 该服务器IP确保已经可以正常访问 设置mysql数据库 sudo mysql_secure_installation 1. Enter current password for root […]

nginx强制使用https访问(http跳转到https)

Posted Leave a commentPosted in Skill

1. nginx的rewrite方法 思路 这应该是大家最容易想到的方法,将所有的http请求通过rewrite重写到https上即可 配置 server { listen 192.168.1.111:80; server_name test.com; rewrite ^(.*)$ https://$host$1 permanent; } 搭建此虚拟主机完成后,就可以将http://test.com的请求全部重写到https://test.com上了 2. nginx的497状态码 error code 497 497 – normal request was sent to HTTPS 解释:当此虚拟站点只允许https访问时,当用http访问时nginx会报出497错误码 思路 利用error_page命令将497状态码的链接重定向到https://test.com这个域名上 配置 server { listen 192.168.1.11:443; #ssl端口 listen 192.168.1.11:80; #用户习惯用http访问,加上80,后面通过497状态码让它自动跳到443端口 server_name test.com; #为一个server{……}开启ssl支持 ssl on; #指定PEM格式的证书文件 ssl_certificate /etc/nginx/test.pem; #指定PEM格式的私钥文件 ssl_certificate_key /etc/nginx/test.key; #让http请求重定向到https请求 error_page […]

申请Let’s Encrypt永久免费SSL证书

Posted Leave a commentPosted in Skill

申请Let’s Encrypt永久免费SSL证书 Let’s Encrypt简介 Let’s Encrypt作为一个公共且免费SSL的项目逐渐被广大用户传播和使用,是由Mozilla、Cisco、Akamai、IdenTrust、EFF等组织人员发起,主要的目的也是为了推进网站从HTTP向HTTPS过度的进程,目前已经有越来越多的商家加入和赞助支持。 Let’s Encrypt免费SSL证书的出现,也会对传统提供付费SSL证书服务的商家有不小的打击。到目前为止,Let’s Encrypt获得IdenTrust交叉签名,这就是说可以应用且支持包括FireFox、Chrome在内的主流浏览器的兼容和支持,虽然目前是公测阶段,但是也有不少的用户在自有网站项目中正式使用起来。 步骤如下: 第一、安装Let’s Encrypt前的准备工作 #检查系统是否安装git,如果已经自带有git会出现git版本号,没有则需要我们自己安装 git –version #git 安装 yum install git #检查Python的版本是否在2.7以上 python -version //2.6版本 #安装python所需的包 yum groupinstall -y “Development tools” #安装python所需的包 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel #获取到Python # wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz # tar xf Python-2.7.12.tgz # cd Python-2.7.12 # ./configure –prefix=/usr/local/python27 # make # make […]

CentOS6系统安装Python2.7

Posted Leave a commentPosted in Skill

简介 CentOS系统安装Python2.7有两种方式: 源码安装 YUM安装 网上大部分教程都是通过源码安装,首先安装比较麻烦,源码安装后还不包含pip,setuptools等工具,需要单独安装。安装过程还会碰到各种疑难杂症。 YUM安装,CentOS6版本默认没有python27的rpm包,需要通过其他第三方repo获取安装包。 源码安装 # wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz # tar xf Python-2.7.12.tgz # cd Python-2.7.12 # ./configure –prefix=/usr/local/python27 # make # make install YUM安装 需要使用到RHEL/CentOS提供的SCL源(软件集) 配置 SCL 源 # yum install centos-release-SCL # yum install scl-utils-build # yum –disablerepo=”*” –enablerepo=”centos-sclo-rh” list # yum install python27 -y 配置Python27以来的系统模块 # find / -name libpython2.7.so.1.0 /opt/rh/python27/root/usr/lib64/libpython2.7.so.1.0 […]