隐藏Nginx和PHP版本号
admin | 服务器相关 | 九月 10th, 2014 | 无评论 »
http段中加入一行:server_tokens off;
php.ini修改expose_php = On到expose_php = Off
admin | 服务器相关 | 九月 10th, 2014 | 无评论 »
http段中加入一行:server_tokens off;
php.ini修改expose_php = On到expose_php = Off
admin | 服务器相关 | 五月 25th, 2014 | 无评论 »
源码编译libmemcached-1.0.18时,configure通过,
sudo make出现错误:
make[1]: *** [clients/memflush.o] Error 1
这是libmemcached一个小的bug,解决方法如下:
clients/memflush.cc 中 42,52行的 opt_servers == false 改为 opt_servers == NULL
admin | 技术教程, 操作系统, 服务器相关 | 七月 18th, 2013 | 无评论 »
出现这个问题是因为 Minimal 安装模式 所以并没有安装 setuptool 软件.
解决办法为:
使用yum 源直接下载安装 或者 去下载 setuptool 软件包安装
#安装setuptool
yum install setuptool
#可以发现执行setup后不全,再安装一个用于系统服务管理
yum install ntsysv
#安装setup中配套的防火墙设置
yum install system-config-securitylevel-tui
#安装setup中配套的网络设置
yum install system-config-network-tui
#安装setup中配套的键盘设置
yum install system-config-keyboard
admin | 小技巧, 技术教程, 操作系统, 服务器相关 | 十二月 25th, 2012 | 无评论 »
crontab不执行的问题困扰了好长时间,脚本写的都正确,但是就是不执行,最终解决方法如下:
crontab -u root /var/spool/cron/root
这样root用户的crontab就生效了
service crond restart
重启下服务就好了
admin | 技术教程, 操作系统, 服务器相关 | 十二月 15th, 2012 | 无评论 »
scp一些大的数据文件,大多时候想挂后台,由于scp要输入密码,所以不能用nuhop,为了安全,也不去配置ssh的公钥等等。
admin | 技术教程, 操作系统, 服务器相关 | 十二月 12th, 2012 | 无评论 »
vsftpd遇到了几个错误:
1. 226 transfer done (but failed to open directory)
2. 553 Could not create file.
3. 550 Create directory operation failed.
因为SELINUX=enforcing模式,所以出现以上3个错误,
解决方法:
setsebool -P ftp_home_dir=on #解决错误1
setsebool -P allow_ftpd_full_access=on #解决错误2、3
4. 530 Login incorrect
解决方法:
vim /etc/pam.d/vsftpd
增加2行:
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers
admin | 技术教程, 服务器相关 | 十二月 9th, 2012 | 无评论 »
1. 停止MySQL:
/etc/init.d/mysqld stop 或者直接kill掉MySQL的进程
2. 启动MySQL
mysqld_safe –skip-grant-tables &
以上操作完成,重启mysql,就可以用root登录mysql,无需密码验证。
3. MySQL> UPDATE mysql.user SET Password = password(‘new-password’) WHERE User = ‘root’ ;
MySQL> flush privileges ;
MySQL> quit ;
搞定,重启mysql
admin | 技术教程, 操作系统, 服务器相关 | 十一月 19th, 2012 | 无评论 »
在RHEL/CentOS中,可以很方便使用setup配置工具配置网络、防火墙、服务等很多关键配置项,使用非常方便,然而采用最小化安装后,默认并没有安装该工具,运行该命令提示如下:
[root@localhost ~]# setup
-bash: setup: command not found
这时就要手动去安装这个快速配置程序了.
[root@localhost ~]# yum install setuptool ntsysv system-config-network system-config-keyboard system-config-network-tui
# yum install setuptool
发现setup命令可以用了,可是系统服务,网络配置,键盘配置,时区配置不见了.安装下这几个配置程序安装系统服务配置
# yum install ntsysv 安装网络配置
# yum install system-config-network 安装键盘时区配置
# yum install system-config-keyboard
system-config-network system-config-keyboard这两个包的依赖很多,能手工改就手动改吧,没特殊应用就不用装了.
admin | 技术教程, 服务器相关 | 八月 18th, 2012 | 无评论 »
当前我用的是APC-3.1.19 stable ,用户自己到 http://pecl.php.net/package/APC 下载最新版。
①安装
wget http://pecl.php.net/get/APC-3.1.19.tgz
tar xzvf APC-3.1.19.tgz
/usr/local/webserver/php/bin/phpize
./configure –enable-apc –enable-apc-mmap –with-php-config=/usr/local/php/bin/php-config –prefix=/usr/local/apc
make && make install
注:安装编译后检查相应目录:
ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
-rwxr-xr-x 1 root root 416628 12-15 17:13 apc.so
安装成功!
②配置/etc/php.ini
vi /usr/local/php/etc/php.ini
shift+g到最末行,末尾加入
[APC]
extension=”apc.so”
apc.enabled = On
apc.shm_segments = 1
apc.optimization = 0
apc.num_files_hint = 0
apc.ttl = 7200
apc.user_ttl = 7200
apc.cache_by_default = On
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.shm_size = 2050M
apc.write_lock = On
apc.stat=0
然后把APC目录下的apc.php复制到可以访问的目录
cp /usr/local/src/APC-3.1.19/apc.php /home/www/htdocs/
③重启Web服务器
admin | 技术教程, 服务器相关 | 八月 17th, 2012 | 无评论 »
所需软件包
libmemcached-1.0.9 https://launchpad.net/libmemcached/1.0/1.0.9/+download/libmemcached-1.0.9.tar.gz
memcached-2.1.0 http://pecl.php.net/get/memcached-2.1.0.tgz (注意上一版本即memcached-2.0.1.tgz 这个包有bug)
系统升级如下:
CentOS release 5.5
CPU = 64-bit, OS = 64-bit
Compiler GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-48)
注意:之前已经安装了libmemcached-1.0.2及php和php的扩展memcached-1.0.2
一、安装libmemcached-1.0.9
[root@niutian365 packages]# tar zxvf libmemcached-1.0.9.tar.gz
[root@niutian365 packages]# cd libmemcached-1.0.9
[root@niutian365 libmemcached-1.0.9]# ./configure –prefix=/usr/local/libmemcached –with-memcached
升级libmemcached从1.0.2升级到1.0.9编译出错如下提示:
make[1]: Entering directory `/packages/libmemcached-1.0.9′
CXX libhashkit/libhashkit_libhashkit_la-aes.lo
CXX libhashkit/libhashkit_libhashkit_la-algorithm.lo
CXX libhashkit/libhashkit_libhashkit_la-behavior.lo
CXX libhashkit/libhashkit_libhashkit_la-crc32.lo
CXX libhashkit/libhashkit_libhashkit_la-digest.lo
CXX libhashkit/libhashkit_libhashkit_la-encrypt.lo
CXX libhashkit/libhashkit_libhashkit_la-fnv_32.lo
CXX libhashkit/libhashkit_libhashkit_la-fnv_64.lo
CXX libhashkit/libhashkit_libhashkit_la-function.lo
CXX libhashkit/libhashkit_libhashkit_la-has.lo
CXX libhashkit/libhashkit_libhashkit_la-hashkit.lo
CXX libhashkit/libhashkit_libhashkit_la-jenkins.lo
CXX libhashkit/libhashkit_libhashkit_la-ketama.lo
CXX libhashkit/libhashkit_libhashkit_la-md5.lo
CXX libhashkit/libhashkit_libhashkit_la-murmur.lo
CXX libhashkit/libhashkit_libhashkit_la-one_at_a_time.lo
CXX libhashkit/libhashkit_libhashkit_la-rijndael.lo
CXX libhashkit/libhashkit_libhashkit_la-str_algorithm.lo
CXX libhashkit/libhashkit_libhashkit_la-strerror.lo
CXX libhashkit/libhashkit_libhashkit_la-string.lo
CXX libhashkit/libhashkit_libhashkit_la-nohsieh.lo
CXXLD libhashkit/libhashkit.la
CXX libmemcached/csl/libmemcached_libmemcached_la-context.lo
In file included from ./libmemcached/common.h:72,
from ./libmemcached/csl/common.h:40,
from libmemcached/csl/context.cc:38:
./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directory
make[1]: *** [libmemcached/csl/libmemcached_libmemcached_la-context.lo] Error 1
make[1]: Leaving directory `/packages/libmemcached-1.0.9′
make: *** [all] Error 2
处理如下:
[root@niutian365 libmemcached-1.0.9]# yum install gcc44 gcc44-c++ libstdc++44-devel
[root@niutian365 libmemcached-1.0.9]# export CC=/usr/bin/gcc44
[root@niutian365 libmemcached-1.0.9]# export CXX=/usr/bin/g++44
重新编译安装libmemcached-1.0.9
[root@niutian365 libmemcached-1.0.9]# ./configure –prefix=/usr/local/libmemcached –with-memcached
[root@niutian365 libmemcached-1.0.9]# make
[root@niutian365 libmemcached-1.0.9]# make install
二、升级安装php的memcached扩展memcached-2.1.0
[root@niutian365 packages]# tar zxvf memcached-2.1.0.tgz
[root@niutian365 packages]# cd memcached-2.1.0
[root@niutian365 memcached-2.1.0]# /usr/local/php/bin/phpize
[root@niutian365 memcached-2.1.0]# ./configure –with-php-config=/usr/local/php/bin/php-config –with-libmemcached-dir=/usr/local/libmemcached
[root@niutian365 memcached-2.1.0]# make
[root@niutian365 memcached-2.1.0]# make install
重启webserver