网络体系出现问题的五大征兆

 转载于51cto.com

有志于对信息系统所产生的大量数据加以分析的企业必须检查用户访问、配置变更以及其它日志事件。

无论是为了提升性能、收集商业情报还是检测安全威胁,日志管理工作都应被划分为以下三个步骤:收集日志、存储数据并通过分析将数据转化为可识别模式。 Continue reading

Posted in 网络安全 | Tagged , | Leave a comment

【树莓派应用实战】在树莓派上通过LNMP来搭建动态网站的服务器

Raspberry Pi到手,顺手搭了个服务器,因为Raspberry Pi硬件配置不是特别高,所有选择的是nginx+mysql+php,基本是按照如下参考网站弄的,但网站上的步骤有点问题,做了一些修改。如果你觉得自己搭服务器麻烦,也可以下载如下网站已经做好的固件,刷如sd卡,开机启动后找到树莓派的ip就可以。

参考网站:http://www.cnx-software.com/2012/08/03/wordpress-for-raspberry-pi-using-nginx-and-mysql/

Raspberry Pi的固件有很多,我安装的是官方的Raspbian,具体安装设置方法请参考

一切准备就绪后就可以开机了,开机后启动终端,输入如下代码,建议使用root权限

本帖隐藏的内容

 

sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-cgi mysql-server

期间会提示设置mysql密码,下载安装好nginx和mysql后在/etc/nginx/sites-available/目录下创建文件wordpress写入如下代码并保存。

# Upstream to abstract backend connection(s) for php
upstream php {
        server unix:/var/run/php5-fpm.sock;
}

server {

        ## Your only path reference.
        root /srv/www/wordpress/public_html;
        listen          80;
        ## Your website name goes here. Change to domain.ltd in VPS
        server_name     _;

        access_log      /srv/www/wordpress/logs/access.log;
        error_log       /srv/www/wordpress/logs/error.log;

        ## This should be in your http block and if it is, it’s not needed here.
        index index.php;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location / {
                # This is cool because no php is touched for static content
                try_files $uri $uri/ /index.php;
        }
        location ~ .php$ {
                #NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini
                include fastcgi_params;
                fastcgi_intercept_errors on;
                fastcgi_pass php;
        }

        location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

然后将此文件复制到/etc/nginx/sites-sites-enabled/目录下,分别删除两个文件夹中的default文件。

然后是下载和解压wordpress(代码已修改为下载最新中文版wordpress)

sudo mkdir -p /srv/www/wordpress/logs/
sudo mkdir -p /srv/www/wordpress/public_html
cd /srv/www/wordpress/public_html
sudo wget http://cn.wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
sudo mv wordpress/* .

设置mysql数据库(其中的raspi为wordpress数据库的密码)

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5340 to server version: 3.23.54

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”localhost”IDENTIFIED BY “raspi”;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> EXIT
Bye
$

将/srv/www/wordpress/public_html目录下的wp-config-sample.php文件名改为wp-config.php然后打开修改其中的以下几行

define(‘DB_NAME’, ‘wordpress’);

define(‘DB_USER’, ‘wordpress’);

define(‘DB_PASSWORD’, ‘raspi’);

重启 nginx 和 php5-fpm

sudo cp wp-config-sample.php wp-config.php
sudo edit wp-config.php

在浏览器中输入http://你的树莓派ip/wp-admin/install.php,就可以安装wordpress啦!

Posted in Linux, 操作系统 | Tagged , , , , , , , , , | Leave a comment

[phpMyAdmin]安装失败提示mcrypt库无法支持问题的解决方案

      今天老季提起在题库服务器上安装phpMyAdmin来管理数据库,我直接上传了phpMyAdmin-3.1.2-all-languages.tar.gz ,然后解压到/var/www/html的目录下,然后通过浏览器去安装和使用,发现提示说

无法载入 mcrypt 扩展,<br />请检查 PHP 配置

使用 yum install php-mcrypt 安装mcrypt扩展时会提示没有安装包

Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do

mcrypt 是加密扩展库,加载了它可以用他里面自带的22种加密解密算法

CentOS6 默认安装的是php5.3.2 ,而默认的 redhat repos php中是没有 mcrypt 扩展的
根据红帽的官方消息(https://bugzilla.redhat.com/show_bug.cgi?id=621268)RHEL 不打算添加PHP的mcrypt 的支持

Joe Orton 2010-08-05 04:47:17 EDT

Thanks for the report.

We are not planning to ship mcrypt support for PHP.

安装到一半,发现php-mcrypt没有相关库,查询了百度和谷歌,说是今后不再出php-mcrypt的模块了。这让我很纠结。那只好找个别的途径来实现了,源码编译安装。

从php 官网下载新的php 5.3 源码包后,解压到本地目录
进入解压目录下的 ext 目录后会发现有 mcrypt ,
进入mcrypt 目录

#cd /ext/mcrypt

#phpize

注意:如果报 -bash:phpize not Found  那么 yum install php-devel 就可以使phpize进行动态编译安装扩展

#./configure  -with-php-config=/usr/bin/php-config

到了这里出现两个问题:

1.     是没有安装cc跟gcc,所以不能安装,CentOS连着网,没有问题,直接用如下命令实现安装:

#yum -y install  gcc cpp  gcc-c++  ncurses ncurses-devel gd-devel php-gd zlib-devel  freetype-devel  freetype-demos  freetype-utils libpng-devel libpng10 libpng10-devel  libjpeg-devel  ImageMagick flex  ImageMagick-devel 

# gcc -v 能看到gcc版本信息就ok了。

然后进入源码解压的目录,进行编译安装:

进入到/root/libmcrypt-2.7.1目录下

#./configure  && make && make install

手动修改php配置文件:

#vi /etc/php.ini

添加如下的内容:extension=/usr/local/lib/libmcrypt.so
 最后重启apache服务器:#service httpd  restart

Posted in Linux | Tagged , , , , , , , , , | Leave a comment