Jax's Blog

Happy Coding,Happy Life


  • Home

  • About

  • Tags

  • Archives

解决百度ueditor图片上传问题

Posted on 2017-06-06 | | Visitors:

$(window).height()高度获取误差

Posted on 2017-05-15 | | Visitors:

在前端通过$(window).height()获取窗口高度总会有100px的误差。搜索得知问题:

  1. html顶部
    1
    <html>应该改成<!DOCTYPE html>  

centos Nginx和PHP-FPM的启动、重启、停止脚本

Posted on 2017-05-08 | | Visitors:

Nginx启动脚本/etc/init.d/nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
#
# Startup script for Nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
configtest || return $?
stop
sleep 1
start
}

reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}

force_reload() {
restart
}

configtest() {
$nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac

编辑好后保存,执行以下命令

1
2
3
4
5
sudo chmod +x /etc/init.d/nginx
sudo /sbin/chkconfig nginx on
# 检查一下
sudo /sbin/chkconfig --list nginx
nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off

完成!可以使用以下命令管理Nginx了

1
2
3
4
5
6
7
8
9
service nginx start
service nginx stop
service nginx restart
service nginx reload

/etc/init.d/nginx start
/etc/init.d/nginx stop
/etc/init.d/nginx restart
/etc/init.d/nginx reload

PHP-FPM启动脚本/etc/init.d/php-fpm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# Startup script for the PHP-FPM server.
#
# chkconfig: 345 85 15
# description: PHP is an HTML-embedded scripting language
# processname: php-fpm
# config: /usr/local/php/etc/php.ini

# Source function library.
. /etc/rc.d/init.d/functions

PHP_PATH=/usr/local
DESC="php-fpm daemon"
NAME=php-fpm
# php-fpm路径
DAEMON=$PHP_PATH/php/sbin/$NAME
# 配置文件路径
CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf
# PID文件路径(在php-fpm.conf设置)
PIDFILE=$PHP_PATH/php/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

rh_start() {
$DAEMON -y $CONFIGFILE || echo -n " already running"
}

rh_stop() {
kill -QUIT `cat $PIDFILE` || echo -n " not running"
}

rh_reload() {
kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
rh_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
rh_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
rh_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
rh_stop
sleep 1
rh_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0

编辑好后保存,执行以下命令

1
2
3
4
5
sudo chmod +x /etc/init.d/php-fpm
sudo /sbin/chkconfig php-fpm on
# 检查一下
sudo /sbin/chkconfig --list php-fpm
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off

完成!可以使用以下命令管理php-fpm了

1
2
3
4
5
6
7
8
9
service php-fpm start
service php-fpm stop
service php-fpm restart
service php-fpm reload

/etc/init.d/php-fpm start
/etc/init.d/php-fpm stop
/etc/init.d/php-fpm restart
/etc/init.d/php-fpm reload

IDEACPU

Posted on 2017-05-07 | | Visitors:

http://stackoverflow.com/questions/21595289/intellij-idea-13-ce-consuming-lots-of-cpu

C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.3\bin
idea.exe.vmoptions
idea64.exe.vmoptions

Mac user
http://stackoverflow.com/questions/20545435/why-is-the-new-version-of-intellij-idea-so-slow?rq=1

mac系统下安装Composer

Posted on 2017-04-26 | | Visitors:

mac下直接用命令行模式下载Composer
使用 curl 指令下载:

1
curl -sS https://getcomposer.org/installer | php

或是沒有安裝 curl ,也可以用 php 指令下载:

1
php -r "readfile('https://getcomposer.org/installer');" | php

手动下载Composer
地址:https://getcomposer.org/composer.phar

当你下载了 composer.phar 后,可以将它放在目录中,但每次当你建立新目录时,你必須再复制一个副本到新目录中,这样比较麻烦。所以最佳做法是将它放到 usr/local/bin 目录中中,成为全域指令。

1
mv composer.phar /usr/local/bin/composer

这样就可以直接在终端使用composer命令了。。。。

如果碰到提示没有权限

Permission denied

执行:

chmod +x /usr/local/bin/composer

为阿里云ECS(CentOS6)配置IPv6隧道地址

Posted on 2017-04-06 | | Visitors:

折腾了N天的IPV6,总算是抽出一晚上的时间来彻底解决了。整理了网上找的一些解决方案。
我们先来看下苹果官方对于IPV6的要求及如何测试(苹果官方说明:开发注意事项和如何测试IPV6 Only的支持)


注册IPV6隧道服务

1、打开https://www.tunnelbroker.net注册一个账号
2、登录到 tunnelbroker.net 后,请点击左侧导航的 Create Regular Tunnel ,输入您的IPv4地址,选择 HongKong 隧道服务器,来创建一个新的ipv6隧道配置

3、此例,创建好的ipv6隧道地址为:2001:470:18:401::2

4、然后,请点击 Example Configureations ,里边会给出在不同系统里可执行的命令,目的是创建ipv6隧道

Read more »

服务器碰到的问题

Posted on 2017-03-23 | | Visitors:

Tomcat 8 访问软连接目录下的文件

1
2
3
4
5
6
7
<!-- Tomcat 7: -->
<Context allowLinking="true" />

<!-- Tomcat 8: -->
<Context>
<Resources allowLinking="true" />
</Context>
  • 如何设置软连接

    例如给一个目录创建软连接
    1
    2
    3
    4
    5
    ln -s /data/resource /data/aaa/resource

    ln -s /data/rednet/upload /www/rednet/admin/upload
    ```
    删除软连接命令:
    rm -rf /data/resource
    1
    2
    3
    最后千万不要带反斜杠,否则会把resource目录下的所有文件删除的。  
    ```
    rm -rf /data/resource/ (不可以这样写)

tomcat 内存设置

1
JAVA_OPTS="-Xms1024m -Xmx4096m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=2048m -Djava.security.egd=file:/dev/./urandom"
  • tomcat启动优化

    -Djava.security.egd=file:/dev/./urandom

Read more »

appleid在账户恢复状态 如何修改密码

Posted on 2017-03-11 | | Visitors:

appleid登陆不知道为什么莫名其妙的提示密码错误,并且我很肯定密码肯定就是这个。然后开始找回密码。。。

问题来了。找回密码选择的恢复账户。然后一直提示等待账户恢复中。致电apple电话客服说,只能等系统恢复账户。没有其他办法。

1
2
今天点到apple美国官网,进到找回密码界面。没想到可以进行选择,谨慎的选择第一个选上。然后成功修改密码。
链接:https://iforgot.apple.com/password/verify/appleid

linux常用命令

Posted on 2017-03-03 | | Visitors:
  • 查看端口占用

    netstat -apn | grep 80

  • 查看系统中文件的使用情况

    df -h

  • 查看当前目录下各个文件及目录占用空间大小

    du -sh *

  • 方法一:切换到要删除的目录,删除目录下的所有文件

    rm -f *

  • 方法二:删除logs文件夹下的所有文件,而不删除文件夹本身

    rm -rf log/*

  • 关闭进程

    killall -9 java

  • 查找文件包含字符串

    grep -rn “hello,world!” *

  • :表示当前目录所有文件,也可以是某个文件名

-r 是递归查找

-n 是显示行号

-R 查找所有文件包含子目录

-i 忽略大小写

  • 端口占用情况

    netstat -noa | grep 80

  • 查看文件夹占用磁盘

    du -h –max-depth=1 /home

  • 查看系统中文件的使用情况

    df -h

  • 查看当前目录下各个文件及目录占用空间大小

    du -sh *

  • 清空文件内容

    echo “” > 文件名

java.lang.NoSuchFieldError:ALIAS_TO_ENTITY_MAP

Posted on 2017-03-02 | | Visitors:

项目部署到服务器报:java.lang.NoSuchFieldError: ALIAS_TO_ENTITY_MAP

错误分析:
运行时的JDK环境低于编译时的JDK环境。

Read more »
<1…456>
Jax

Jax

54 posts
1 categories
24 tags
GitHub E-Mail 摄影/图虫
© 2022 Jax
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4
湘ICP备12012411号-3