超强实战模板Rva-react-template介绍

前言

Rva-react-template是在universal-redux-template迭代开发,并在10+线上产品运用过的实战型react模板。使用Redux + React-router + Express构建,支持服务端/客户端同构。不管是入门React,还是进阶,或者构建大型复杂前端应用,Rva-react-template都可以很好地满足你的需要。

案例:

  • 空中绿洲
  • 益派云调查
  • 某滑雪场官网
  • 某出版社读书会
  • 某跨国集团智能供应链项目
  • 某量衣应用h5版
  • 某区块链行情h5站点
  • 尚尚珍宝h5版
  • 房88 – 美国房产中介平台
  • 某跨国集团财务工具
  • 师生阅读交流平台
  • 实时课堂应用

为什么需要模板

从头搭建一个react应用的开发环境不是一件容易的事情,需要设置很多库,比如webpack, babel, 测试框架等等。而Rva-react-template,就是为此而生:用最简单的逻辑组合这些工具,功能刚刚够用好用。没有过多的炫技,简单地不能再简单,却又远超一个demo。众多线上项目检验了它的实用性。

怎么使用

  • 克隆并重命名这个项目: $ git clone https://github.com/rvajs-cn/rva-react-template.git ./my-react-project
  • 移除 .git 文件夹: $ cd my-react-project; rm -rf .git
  • 初始化成一个新的git项目: $ git init
  • 安装依赖: $ yarn install
  • 启动项目,开始您的react之旅! $ yarn start
  • 使用Mocha, Enzyme, Sinon 和 Chai来运行测试: $ yarn test:ci
  • 生成 container/component/action 和相应的测试文件: $ ./bin/generate <type> <path>

例如: $ ./bin/generate component myNamespace/MyComponent

特点:

  • 服务端同构渲染(SEO友好), 并支持异步数据获取
  • 支持服务端重定向
  • 分离vendor和app js文件
  • 使用Immutable 做数据管理
  • 使用Webpack,客户端支持Hot Reload
  • 支持服务端Hot Reload
  • 支持Sass

技术栈:

技术支持

以上项目都是RvaJS团队使用Rva-react-template实现的项目。原项目mz026/universal-redux-template已经有两年没有维护。而Rva-react-template在两年的过程中,虽然迭代不多,但保证了核心库如react/react-router/webpack的持续更新,不断在新的项目中使用最新的代码。

更重要的是,用同一模板构建从小项目到大型项目,从web到h5,RvaJS团队积累了大量的开发/部署甚至运维的经验。

React线上培训(广告)

案例中的部分项目,因为隐私而不能公开网址,项目的代码也不方便在网上公布。但多年来的React开发经验,我们愿意不断地以文章/问答的形式传授给需要的人。由此,RvaJS团队推出以下付费服务:

1、一元试用。点此购买,订单页会有入群说明。购买一元试用服务后,管理员会允许您加入react付费交流群。ReactJS会负责群的日常管理,保障群里交流的都是跟react相关的技术。

2、季卡会员100元。点此购买,订单页会有入群说明。季卡会员,享有针对Rva-react-template的线上有问必答服务。

3、年卡会员360元。点此购买,订单页会有入群说明。年卡会员,享有Rva-react-template有问必答服务,支持线上和语音问答。

wordpress自动保存远程图片

分步教程

1、在workpress官网搜索qqworld插件。

https://wordpress.org/plugins/search/qqworld/

如上图,单击选择QQWorld Auto Save Images插件,进入详情页面,下载该插件源码zip文件(qqworld-auto-save-images.zip)到本地,然后将zip上传到服务器的wp-contents/plugins/目录下。

2、解压源码

cd wp-contents/plugins
unzip qqworld-auto-save-images.zip

3、进入wordpress后台->plugins页面,激活该插件。

4、添加一篇文章,从其他网站拷贝带图片的html。点击发布,然后查看图片地址是否已经是自己的域名。


扩展

1、修改qqworld配置-取消设置首图为文章封面

在后台->plugins页面找到qqworld,点击settings

取消Set Featured Image的选项即可。

WordPress安装百度统计教程

对于自建网站来说统计系统一直是不可或缺的一部分,为网站安装访客统计系统,可以让我们清楚的了解到网站的情况,知道哪些内容受到用户欢迎,哪些内容又需要改进,以及网站每天的情况。百度统计是国内使用人数很多统计系统,在本文中,我们将为大家详细讲解WordPress安装百度统计方法

首先我们打开 https://tongji.baidu.com/,注册一个账号,注意这个并不是你的百度账号,需要单独注册,类型选择站长版

注册好登陆以后,默认情况下是没有信息的,我们需要把自己的网站添加到百度统计

选择 管理 – 新增网站

会看到跳出如下的窗口,按照格式填写即可

注意:如果你想要使用www前缀的话,给域名和首页都加上www前缀

提交域名后,我们就会得到一段Javascript统计代码,接下来我们需要做的就是把这段统计代码安装到WordPress中,点击按钮复制代码

由于WordPress并没有内置插入JS功能,我们需要借助插件来添加代码,这里我使用的是IT’s Tracking Code这款简单的插件(需要上传安装)

插件装好后,选择 设置 – Tracking Code,把代码粘贴到上边的Head文本框里面并保存

回到百度统计中,在第3步中,有一个代码安装检查的按钮,点击它

如果最后输出代码安装正确,统计系统就安装成功了,以后如果再有人访问网站就会被加入到统计系统中了

怎么在CentOS 7上安装MySQL

Introduction

MySQL is a popular free and open source database management application. It forms part of the LAMP Stack (Linux, Apache, MySQL, PHP), a software collection used for servers.

With the release of CentOS 7, MySQL was dropped from the standard repositories in favor of MariaDB. MariaDB is fully compatible with MySQL and can be substituted almost seamlessly.

This guide will walk you through how to install MySQL on CentOS 7.

how to install mysql on centos

Prerequisites

  • A system running CentOS 7
  • user account with sudo privileges
  • A terminal window (Menu > Applications > Utilities > Terminal)
  • The Yum package manager (included by default)

Guide To Installing MySQL on CentOS 7

Step 1: Download the repository packages

Open a browser window, and go to the following address:

https://dev.mysql.com/downloads/repo/yum/

This page will list details on the Yum repository that holds the MySQL files. Scroll down to find the Red Hat Enterprise Linux version that you want to download. (At the time of writing, the website offers Linux 7 and Linux 6 – you’ll probably want Linux 7).

You can click the Download button, which takes you to a registration page. You can sign up if you’d like, or look a little lower for the “No thanks, just start my download” link.

Alternately, you can open a terminal and use the wget command to save the file. On the first webpage that lists the release versions, you’ll see a gray subtext that shows something like “(mysql80-community-release-el7-1.noarch.rpm)”.

Make note of this, then open a terminal window, then enter the following command:

sudo wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm.noarch.rpm

The system should reach out and download the files. (Make sure you check the website and copy the exact release ID – use that in your Terminal command.) Leave the browser window open for the next step.

Step 2: Add the Software Repositories

The files we just downloaded provide access to the MySQL software repositories. Before adding them, check the MD5 value to authenticate the software:

sudo md5sum mysql80-community-release-el7-1.noarch.rpm

The system should respond with a long string of letters and numbers.

Switch back to the MySQL web page and look just below the Download link to find a gray string of numbers labeled MD5.

Compare the MD5 value on the web page to the MD5 value you generated in the terminal window. If they match, proceed to the next step. (If they don’t match, it’s possible that your download was corrupted in transit. Or, it’s possible that the download has been compromised. Repeat Steps 1 and 2 and overwrite the downloaded file. If the MD5 values still don’t match, stop the procedure.

To update the software repositories, use the command:

sudo rpm –ivh mysql80-community-release-el7-1.noarch.rpm

Make sure you’ve entered the release version from Step 1. This will add 2 new Yum repositories that we can get MySQL from.

Step 3: Install MySQL

Install MySQL on CentOS by entering the following:

sudo yum install mysql-server

The system will ask for confirmation, press Y to confirm.

It should also request that you accept a GPG (Gnu Privacy Guard) key. This is another security confirmation because we just added two new software sources. Press Y again, and the system should download and install the software.


NOTE: MySQL includes several security plugins to authenticate connections to the server, password verification and securing storage for sensitive data. All of these are available in the free version.


Using MySQL

Managing MySQL Service

You’ll need to start the MySQL service by entering:

sudo systemctl start mysqld

To check the status of MySQL use the command:

sudo systemctl status mysqld

The system will display several lines of information about the MySQL service. In the Active line, it should display active: (running). You may also see a line below that shows a timestamp of when the service was started.

By default, the MySQL service is set to launch at startup.

To disable it, you can use the disable command:

sudo systemctl disable mysqld

To stop the MySQL service, use the stop command:

sudo systemctl stop mysqld

Find Temporary Password

The MySQL installation routine sets up a default temporary password.

Use the grep command to find the password:

sudo grep 'temporary password' /var/log/mysqld.log

Make a note of the password.

Configuring and Securing

Your new MySQL installation comes with a security script to make securing configurations easier.

Launch the script with the following terminal command:

sudo mysql_secure_installation

The system will prompt you to enter the default root password. Enter the password you recovered earlier.

Next, the system will tell you that the password has expired, and prompt you to enter a new one. Enter a new password, make a note of it, then press Enter.

The system will rate your password strength, and ask if you want to enter a new, stronger password. If you’re satisfied with your password strength, hit the spacebar. To revise your password, press Y.

The Secure Installation script will continue, and you can safely reply Y to the rest of the prompts, which include:

  • Remove anonymous users
  • Disallow remote root login
  • Remove test database
  • Reload privilege tables

Log into MySQL

To launch MySQL from the command line, use the command:

mysql –u root –p

The system will prompt you to enter your password. Enter the password you set in Step 6, and the system should respond by displaying the MySQL shell.

It lists necessary information about the MySQL software, and your command prompt will change to mysql> to indicate that you’re logged into the MySQL software.

Once you’re done, you can log out with:

exit

The command prompt will change, indicating that you’ve logged out of MySQL.

Conclusion

Installing MySQL on CentOS 7 is straightforward. Once you know where to add the software repositories, you should be up and running with your new installation.

CentOS 7和RHEL 7 上 PHP 7.0, 7.1, 7.2的安装

As we know that PHP is the most important part of LAMP applications (WordPress, Joomla, Drupal & Media wiki etc). Now a days most of these applications require PHP 7 for their installation and configuration. Main advantage of PHP 7.x is that it will load your web application faster and will consume less server’s resources like CPU and RAM.

By default, PHP 5.4 is available in CentOS 7 and RHEL 7 yum repositories.  In this article we will demonstrate how to install latest version of PHP on CentOS 7 and RHEL 7 Servers.

Installation Steps of PHP 7.0, 7.1 & 7.2 on CentOS 7 Server

1) Install yum-utils and enable EPEL repository

Login to your server and use the below yum command to install yum-utils & enable epel repository

[root@linuxtechi ~]# yum install epel-release yum-utils -y

2) Download and Install remirepo using yum command

[root@linuxtechi ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3)  Base on your requirement, configure the PHP 7.x repository

To configure PHP 7.0 repository, use below command,

[root@linuxtechi ~]# yum-config-manager --enable remi-php70

To configure PHP 7.1 repository, use below command,

[root@linuxtechi ~]# yum-config-manager --enable remi-php71

To configure PHP 7.2 repository, use below command

[root@linuxtechi ~]# yum-config-manager --enable remi-php72

4) Install PHP 7.2 along with dependencies.

In this tutorial, I will install latest version of PHP 7.2 along with its modules, Run beneath yum command

[root@linuxtechi ~]# yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

Note: To search all PHP modules use  below command:

[root@linuxtechi ~]# yum search php | more

5) Verify the PHP version

Once all the PHP 7.2 and its dependencies are installed in step4), use below command to verify the installed PHP version,

[root@linuxtechi ~]# php -v
PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies

Installation Steps of PHP 7.x on RHEL 7 Server

1) Enable EPEL, RHEL 7 Server Optional repository and Install remirepo rpm

Login to your RHEL 7 Server and run the beneath commands one after the another to enable EPEL repository, install remirepo and enable RHEL 7 Server optional repository

[root@linuxtechi ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@linuxtechi ~]# wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@linuxtechi ~]# rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm 
[root@linuxtechi ~]# subscription-manager repos --enable=rhel-7-server-optional-rpms

2) Configure PHP 7.x repo

[root@linuxtechi ~]# yum install yum-utils
[root@linuxtechi ~]# yum-config-manager --enable remi-php72

3) Install PHP 7.2 and its dependencies

[root@linuxtechi ~]# yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

4) Verify PHP Version

[root@linuxtechi ~]# php -v

PHP 7 Test Page Verification

I am assuming Apache web Server is installed on your system, start its service using below systemctl command

[root@linuxtechi ~]# systemctl start httpd
[root@linuxtechi ~]#

Now create a info.php file under /var/www/html with following contents,

[root@linuxtechi ~]# cd /var/www/html/
[root@linuxtechi html]# vi info.php
<?php
phpinfo();
?>

Open the web browser and type the ip of your server followed by info.php,

http://Server-IP-Address/info.php

This confirms that you have successfully installed PHP 7.2.7 on your system. That’s all from this article, please do share your feedback and comments.

扩展

安装php mysql扩展

yum install php72-php-mysqlnd

安装php72-fpm

yum install php72-php-fpm

启动php72-fpm

使用systemctl来管理php72-fpm

systemctl enable php72-php-fpm.service

Use systemctl command:

sudo systemctl enable php72-php-fpm.service

Sample outputs:

Created symlink from /etc/systemd/system/multi-user.target.wants/php72-php-fpm.service to /usr/lib/systemd/system/php72-php-fpm.service.

启动/停止/重启/查看状态

systemctl start php72-php-fpm.service
systemctl stop php72-php-fpm.service
systemctl restart php72-php-fpm.service
systemctl status php72-php-fpm.service

参考

https://www.cyberciti.biz/faq/how-to-install-php-7-2-on-centos-7-rhel-7/