萌网招收外链,速联系

截止2015年10月,萌嘟嘟网站做了友链的朋友有效反链7条,之前的小博圈子很多貌似都退出了,有几个工作后也没在更新,特在此招收外链。长期置顶……ing
要求:百度BR>1,谷歌权重pr>1

这个要求说实话没啥难度,萌嘟嘟期待新朋友的加入,内容以个人生活博文优先,技术博文更佳,禁五禁。
萌网天下,招收朋友

laravel5.4 restful接口开发

1、使用composer安装dingo/api和tymon/jwt-auth

cd /www/web/www.cms.com
composer require "dingo/api:dev-master" //目前低版本的dingo/api不能支持laravel5.4,使用dev版本的dingo/api
composer require "tymon/jwt-authi:dev-master"
文档:这里将会用dingo api和json web token来开发后台API
(1)dingo api文档,https://github.com/dingo/api/wiki
(2)jwt-auth文档,https://github.com/tymondesigns/jwt-auth/wiki

后端API配置

(1)在config/app.php中加入

'providers' => [
    //自己添加的laravel拓展
    Dingo\Api\Provider\LaravelServiceProvider::class,
    Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class
   ],

'aliases' => [
    'APIRoute'=>Dingo\Api\Facade\Route::class,                //dingo
    'API'=>Dingo\Api\Facade\API::class,                       //dingo
    'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,        //jwt认证
    'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,  //jwt认证
   ],

(2)执行

php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"

执行完后config目录下就会自动生成api.php和jwt.php,接下来执行php artisan jwt:generate生成JWT_SECRET,最后在.env文件中写入

API_STANDARDS_TREE=vnd
API_SUBTYPE=myapp
API_PREFIX=api
#API_DOMAIN=api.cms.com
API_VERSION=v1
API_DEBUG=true

在app/Http/Kernel.php中加入

protected $routeMiddleware = [
  //自己添加的路由中间件
  'jwt.auth'=> \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
  'jwt.refresh'=>\Tymon\JWTAuth\Middleware\RefreshToken::class,
  ];

(3)jwt-auth依赖于user表,也就是database/migrations/2014_10_12_000000_create_users_table.php,执行php artisan migrate生成user表,并确保app/User.php存在,然后类中加入protected $table = ‘user’;,不然声明使用user表,不然会默认使用users表.

 

初尝dingo api(接下来文件配置的目录结构)

打开/routes/api.php文件

(1)引入dingo api,$api = app('Dingo\Api\Routing\Router');
(2)创建API版本
//开始定义api的接口路由
$api = app('Dingo\Api\Routing\Router');
$api->version('v1',function ($api){
    $api->group(['namespace' => 'App\Http\Controllers\Api','middleware'=>'jwt.auth'], function($api){
        $api->get('test','TestController@index');
    });
});

创建相应的controller和action

//文件路径:app/Http/Controllers/ApiController.php
/* 定义一个api使用的公共模块 */
namespace App\Http\Controllers;
use Dingo\Api\Routing\Helpers;
use Illuminate\Routing\Controller;

class ApiController extends Controller{
    use Helpers;
}
//文件路径:app/Http/Controllers/Api/TestController.php
namespace App\Http\Controllers\Api;   
use App\Http\Controllers\ApiController; //引用自己定义的api公共类
use Illuminate\Http\Request;            //接收传参使用 function(Request $request,$id=1)
use Illuminate\Support\Facades\Input;   //接收传参使用 $someInput = Input::all();

class TestController extends ApiController {

    //获取get过来的用户id
    public function index(Request $request,$id=1){
        // $users = DB::select('select * from m_userinfo where id = ?', [$id]);
        //print_r($users);
        //$someInput = $request->input('id');
        $someInput = Input::all();
        var_dump($someInput);
    }
}

执行php artisan api:routes

参考文档:http://www.cnblogs.com/helbing/p/5635290.html

drupal8忘记密码怎么办

Generate a new password

First, you have to generate a password hash that is valid for your site.Execute the following commands from the command line, in the Drupal 8 root directory:

$ php core/scripts/password-hash.sh 'your-new-pass-here'
password: your-new-pass-here    hash: $S$EV4QAYSIc9XNZD9GMNDwMpMJXPJzz1J2dkSH6KIGiAVXvREBy.9E

Be careful not to include more or less characters as the hash.We will use the generated password later.

Update the user password.

Now you need to update the user password, in our case we need update the Administrator password, fortunately the UID for Administrator is 1 equal to previous versions of Drupal.

With the new password we need run the following SQL statement.

UPDATE users_field_data SET pass='$S$E5j59pCS9kjQ8P/M1aUCKuF4UUIp.dXjrHyvnE4PerAVJ93bIu4U' WHERE uid = 1;

Dealing with Cache

At this point if you try to login in the Drupal 8 website you will rejected, it’s because the login system don’t read directly the table users_field_data instead of a cache for entities is used.

To flush the cache for a specific user entity with compromise the rest of cache of your system you can use the following SQL statement.

DELETE FROM cache_entity WHERE cid = 'values:user:1';

Now you can grab a cup of coffee/tea and enjoy your Drupal 8 website.

I hope you found this article useful.

ubuntu连接WPA2 无线网络

先查询当前网卡名称:ifconfig

enp0s25   Link encap:Ethernet  HWaddr f4:4d:30:65:7e:e0(本地有线连接)
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:2623 errors:0 dropped:1980 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:187104 (187.1 KB)  TX bytes:6346 (6.3 KB)
          Interrupt:20 Memory:aa100000-aa120000

lo        Link encap:Local Loopback(本地回环)
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:236 errors:0 dropped:0 overruns:0 frame:0
          TX packets:236 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:17158 (17.1 KB)  TX bytes:17158 (17.1 KB)

wlp2s0    Link encap:Ethernet  HWaddr 00:16:eb:38:88:3a(本地无线连接)
          inet addr:192.168.1.12  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:ebff:fe38:883a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:277 errors:0 dropped:0 overruns:0 frame:0
          TX packets:232 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32805 (32.8 KB)  TX bytes:44062 (44.0 KB)

生成WiFi密钥的psk

使用命令wpa_passphrase
root@OrangePi_kali:~# wpa_passphrase ChinaNet-protime Dai13995535567
network={
	ssid="ChinaNet-protime"
	#psk="mengdodo.com"
	psk=11c53fe61e03398cc272abdee2e3e252637db7aab6a764cdd633922fbadbb71a
}

复制好上面psk的值,配置 /etc/network/interfaces

sudo vim /etc/network/interfaces

具体内容

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "ChinaNet-protime"
wpa-psk 11c53fe61e03398cc272abdee2e3e252637db7aab6a764cdd633922fbadbb71a
具体各行配置的意思如下:
auto lo //表示使用localhost
iface eth0 inet dhcp //表示如果有网卡eth0, 则用dhcp获得IP地址 (这个网卡是本机的网卡,而不是WIFI网卡)
auto wlan0 //表示如果有wlan设备,使用wlan0设备名
allow-hotplug wlan0 //表示wlan设备可以热插拨
iface wlan0 inet dhcp //表示如果有WLAN网卡wlan0 (就是WIFI网卡), 则用dhcp获得IP地址
wpa-ssid “你的wifi名称”//表示连接SSID名
wpa-psk “你的wifi密码”//表示连接WIFI网络时,使用wpa-psk认证方式,认证密码

reboot

drupal7伪静态遇到的坑

萌嘟嘟按照以往的经验再新环境下安装drupal7,下方时lnmp1.3一键包下的vhost配置

location ~ '\.php$|^/update.php' {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        # Security note: If you're running a version of PHP older than the
        # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
        # See http://serverfault.com/q/627903/94922 for details.
        include fastcgi_params;
        # Block httpoxy attacks. See https://httpoxy.org/.
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        # PHP 5 socket location.
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        # PHP 7 socket location.
        # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
          fastcgi_pass  unix:/tmp/php-cgi.sock;
    }

重启nginx后访问后台的Home » Administration » Configuration » Clean URLs,点击button却提示The clean URL test failed.难道是出bug了,还是我vhost配置不对了?结果都不是。

Your url at the clean url page should be;
http://www.your-site.com/?q=admin/config/search/clean-urls
So edit it and change it to;
http://www.your-site.com/admin/config/search/clean-urls
Now you should see the enable clean url button.Enable it and get yourself a cup of coffee.
Hope that does the trick.

pureftpd安装配置详细过程

工作中总会离不开FTP,这些年一直习惯用pureftp,很久没安装,找到以前写的文档,这次顺便把文档整到ttlsa里,以后可以参考。以前自己写文档确实很啰嗦。

准备pureftp

#cd /usr/local/src/
#wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.22.tar.gz
#tar –xzvf pure-ftpd-1.0.22.tar.gz

编译和安装

#cd pure-ftpd-1.0.22
#.configure \
–prefix=/usr/local/pureftpd \ //pureftpd安装目录
–with-everything \ //安装几乎所有的功能,包括altlog、cookies、throttling、ratios、ftpwho、upload script、virtual users(puredb)、quotas、virtual hosts、directory aliases、external authentication、Bonjour、privilege separation本次安装只使用这个选项。
--with-cookie \ //当用户登录时显示指定的横幅
--with-diraliases \ //支持目录别名,用快捷方式代cd命令
--with-extauth \ //编译支持扩展验证的模块,大多数用户不使用这个选项
--with-ftpwho \ //支持pure-ftpwho命令,启用这个功能需要更多的额外内存
--with-language=english \ //修改服务器语言,默认是英文,如果你要做修改,请翻译‘src/messages_en.h’文件
--with-ldap \   //LADP目录支持,需要安装openldap
--with-minimal \ //FTP最小安装,最基本的功能
--with-mysql \ //MySQL支持,如果MySQL安装在自定义目录上,你需要使用命令—with-mysql=/usr/local/mysq这类
--with-nonroot \   //不需要root用户就可以启动服务
#make
#make install

安装配置文件

#cd /usr/local/src/pure-ftpd-1.0.22 //切换到源码目录
#cd configuration-files        //切换到这个目录
#chmod 755 pure-config.pl   //让用户有完全权限(因为默认没有执行权限)
#cp pure-config-pl /usr/local/pureftpd/bin    //把执行文件复制到bin目录下
#mkdir /usr/local/pureftpd/etc              //新建FTP的配置文件夹目录
#cp pure-ftpd.conf /usr/local/pureftpd/etc   //复制ftp配置文件到etc中
#cd ..     //切换到/pure-ftpd-1.0.22目录中
#cp pureftpd-ldap.conf /usr/local/pureftpd/etc     //相关配置文件复制到etc中
#cp pureftpd-mysql.conf /usr/local/pureftpd/etc //相关配置文件复制到etc中
#cp pureftpd-pgsql.conf /usr/local/pureftpd/etc   //相关配置文件复制到etc中

pure-ftpd.conf配置

ChrootEveryone              yes           //锁定所有用户到家目录中
# TrustedGID                    100 //信任组ID100,可以不锁定
MaxClientsNumber            50           //最大的客户端数量
MaxClientsPerIP             8        //同一个IP允许8个链接
DisplayDotFiles             no //不显示隐藏文件
AnonymousOnly               no   //只允许匿名用户
NoAnonymous                 yes//不允许匿名用户
DontResolve                 yes    //禁止反向解析
MaxIdleTime                 10    //最大空闲10分钟
# LDAPConfigFile                /etc/pureftpd-ldap.conf    //LDAP配置文件目录
# MySQLConfigFile               /etc/pureftpd-mysql.conf//MySQL配置文件目录
# PGSQLConfigFile               /etc/pureftpd-pgsql.conf //PGSQL配置文件目录
PureDB                        /usr/local/pureftpd/etc/pureftpd.pdb //虚拟用户数据库
# UnixAuthentication            yes //主机认证
LimitRecursion              2000 8       //别表最大显示2000个文件,最深8个目录
AnonymousCanCreateDirs      no     //是否允许匿名用户创建目录
#MaxLoad                     4   //最多可下载的数量
# PassivePortRange          30000 50000      //主动连接的端口范围
ForcePassiveIP                192.168.0.1   //这个地址总是直到匿名目录
# AnonymousRatio                1 10         //匿名用户上传下载速度比率
# UserRatio                 1 10                  //用户上传下载速度比率
# Bind                      127.0.0.1,21     //绑定IP和端口
# AnonymousBandwidth            8             //匿名用户带宽8KB
# UserBandwidth             8                     //用户带宽8KB
Umask                       133:022         //文件和目录的umask
MinUID                      1000             //用户ID至少要大于1000才能登陆
AllowUserFXP                no           //是否允许用户使用FXP协议登陆
AllowAnonymousFXP           no         //是否允许匿名用户使用FXP协议
ProhibitDotFilesWrite       no                 //是否允许写入点文件
ProhibitDotFilesRead        no                //是否允许读取点文件
AnonymousCantUpload         yes         //不允许匿名用户上传
#NoChmod                     yes     //不允许用户改变权限
#KeepAllFiles                yes           //允许用户断点续传
#Quota                       1000:10//磁盘配额
#MaxDiskUsage               99   //磁盘的最大利用率
#NoRename                  yes //不允许自动重命名
IPV4Only                 yes    //只允许使用IPV4协议

新建虚拟用户

注意:新建虚拟用户之前需要创建一个组合用户(属于操作系统上的)。

#groupadd ftpgroup        //新建系统组
#useradd –g ftpgroup –d /dev/null –s /sbin/nologin ftpuser //新建用户加入ftpgroup中
#cd /usr/local/pureftpd/bin     //切换到bin目录中
#./pure-pw useradd puser –u ftpuser –d /www/ftptest –m
//pure-pw useradd 虚拟用户名 –u 寄生到系统用户名 –d FTP目录 –m(把用户密码加入PDB数据库中,不需要重启FTP)
#cd /www      //切换到WWW中
#chmod –R ftpuser:ftpgroup ftptest //把FTP目录的所属用户和组改为虚拟用户所依托的系统用户和组

启动测试

#/usr/local/pureftpd/bin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
Running: /usr/local/pureftpd/sbin/pure-ftpd -A -c50 -B -C8 -E -fftp -H -I10 -lpuredb:/usr/local/pureftpd/etc/pureftpd.pdb -L2000:8 -s -U133:022 -u1000 -i -Z -4

注:如果出现running说明启动成功。接下来ftP连接进行测试

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using passwor

#1.停止mysql数据库
/etc/init.d/mysqld stop
 
#2.执行如下命令
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
 
#3.使用root登录mysql数据库
mysql -u root mysql
 
#4.更新root密码
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
#最新版MySQL请采用如下SQL:
mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root';
 
#5.刷新权限 
mysql> FLUSH PRIVILEGES;
 
#6.退出mysql
mysql> quit
 
#7.重启mysql
/etc/init.d/mysqld restart搜索
 
#8.使用root用户重新登录mysql
mysql -uroot -p 
Enter password: <输入新设的密码newpassword>

ubuntu redis开机自启动

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          mengdodo
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: redis service
# Description:       redis service daemon
### END INIT INFO
#
# chkconfig: 2345 10 90
# description: Start and Stop redis
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

REDISPORT=6379
#EXEC=/usr/local/bin/redis-server
#CLIEXEC=/usr/local/bin/redis-cli
EXEC=/www/webservice/redis-3.2.8/src/redis-server
CLIEXEC=/www/webservice/redis-3.2.8/src/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
#CONF="/etc/redis/${REDISPORT}.conf"
CONF="/etc/redis/redis.conf"

case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
                echo "报告老板:海天盛筵大美女开始上钟了"
        else
                echo "报告老板:正在呼唤大美女队列,你马上就可以啪啪啪了……(切记必须sudo运行,否则没有pid文件产生)"
                $EXEC $CONF
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
                echo "报告老板:队列妹子压根不在,所以redis早就停止了!"
        else
                PID=$(cat $PIDFILE)
                echo "redis正在关闭中……"
                $CLIEXEC -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
                    echo "报告老板:三陪女redis正在收集她的作案工具,准备打包走人……"
                    sleep 1
                done
                echo "报告老板:海天盛宴绿茶婊redis已经走了,下次再战!"
        fi
        ;;
    restart|force-reload)
        ${0} stop
        ${0} start
        ;;
    status)
        EXIST=`ps -ef | grep ${EXEC} | grep -v grep | awk '{print $2}' | xargs`
        if [ -z ${EXIST} ]
        then
                echo "报告老板:队列没有运行. "
                return 0
        else
                echo "报告老板:队列正在运行."
                return 1
        fi
        ;;
    *)
        echo "报告老板:给定的参数有start,stop,restart,status"
        ;;
esac
设置开机自动启动,关机自动关闭
     sudo update-rc.d redis-server defaults
启动Redis:
     sudo /etc/init.d/redis-server start

解决insserv: warning: script ‘服务名’ missing LSB tags and overrides的问题

编写了一个tomcat开机自启动脚本,执行没问题,但是在安装mysql的时候出现了大量的:

insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!

居然还导致mysql安装后的自动配置提示失败,按照LSB tags规范改写脚本如下(debian8环境):

#!/bin/bash
### BEGIN INIT INFO
# Provides:          bbzhh.com
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: tomcat service
# Description:       tomcat service daemon
### END INIT INFO
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.

ubuntu wget Unable to establish SSL connection.

ubuntu wget Unable to establish SSL connection.
有些网站不允许非浏览器方式获取文件,用加参数:
wget --no-check-certificate  --user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/14.0" https://github.com/phpredis/phpredis/archive/develop.zip
phpredis启动多个work时启动失败----php 多进程pcntl安装
cd lanmp
cd php-5.2.17
cd ext/pcntl
/www/wdlinux/php/bin/phpize
./configure --with-php-config=/www/wdlinux/php/bin/php-config
make
make install

注意:mamp需要在软件上选择文件->修改->php 5.5.25 php.ini文件添加;php终端执行需要vim /Applications/MAMP/bin/php/php5.5.26/conf/php.ini 添加

修改php.ini文件添加:
[pcntl]
extension="/Applications/MAMP/bin/php/php5.5.26/lib/php/extensions/no-debug-non-zts-20121212/pcntl.so"