zoukankan      html  css  js  c++  java
  • lamp环境服务器配置文档

    服务器配置命令开始(蓝色为输入命令,灰色为反馈内容):

    Yum update

    Reboot;

    yum -y install mysql mysql-server mysql-devel php php-devel php-common

    php-gd php-curl php-prec php-xml  php-tidy php-pear php-mysql php-pdo php-pdb php-fpdf* php-ldap php-dba php-cli php-mcrypt php-mbstring php-oauth  php-soap  php-snmp  gcc  gcc-c++

    yum -y install  glibc.i686 libstdc* libstdc++.so.6

    yum -y install memcached php-pecl-memcache   <-== 有时不会装

    yum -y install wget

    文件配置:

    httpd.conf

    KeepAlive on

    KeepAliveTimeout 15

    MaxKeepAliveRequests 100

    ServerName localhost:80

    DirectoryIndex index.html index.php

    NameVirtualHost *:80

    <VirtualHost *:80>

    ServerAdmin nhuang@redidai.com

    DocumentRoot /home/www/plan2.0.5.3

    ServerName 25.redidai.com

    ServerAlias 25.redidai.com

    ErrorLog logs/25.com-error_log

    CustomLog logs/25.com-access_log common

    <Directory " /home/www/plan2.0.5.3">

    allow from all

    order allow,deny

    AllowOverride All

    </Directory>

    RewriteCond %{HTTP_HOST} ^redidai.com [NC]

    RewriteRule ^/(.*)$ http://www.{HTTP_HOST}/$1 [R=301,L]

    </VirtualHost>

    NameVirtualHost *:80

    php.ini

    pcre.backtrack_limit=-1

    pcre.recursion_limit=-1

    iptables

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

    -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

    错误解决:

    解决SELINUX 权限引起的目录无法访问

    setenforce 0

    修改/etc/selinux/config文件中设置SELINUX=disabled/permissive ,然后重启服务器。

    chcon -t httpd_sys_content_t -R 修改权限的文件

    chown apache:apache -R plan2.0.5.3.1

    服务器计划任务

    #每隔1分钟,结束APPCHE超过10分钟,CPU超过10%的死进程

    crontab -e

    */1 * * * *  top -n 1 -b |grep 'apache' |awk 'substr($11,3,1)>0 && $9 > 10 {print "kill", $1}'|sh

    Sphinx 配置

    yum –y install mysql-connector-odbc  postgresql.x86_64

    下载shpinx rpm包到/home/soft文件夹下

    下载地址:http://sphinxsearch.com/downloads/release/

    rpm -ivh sphinx-2.1.5-1.rhel6.x86_64.rpm

    sphinx位置:/etc/sphinx

    将配置文件拷贝到/etc/sphin下

    1.停止sphinx。Searchd –stop(第一次不用)

    2.给所有字段建立索引。Indexer --all

    3.启动 sphinx。/usr/local/sphinx/bin/searchd

    search “深圳”,如果安装成功,则显示出搜索结果

    NFS 配置

    (只包含客户端配置—即代码服务器端,服务器端—即cdn端配置另外描述)

    客户端配置—即代码服务器端配置

    yum –y install nfs-utils.x86_64

    安装pixel

    1.安装node.js

           wget http://nodejs.org/dist/v0.6.1/node-v0.6.1.tar.gz

           本地测试下载的是这个版本,如果要高版本的话可以找高版本的地址

          

           tar zxvf node-v0.6.1.tar.gz

           cd node-v0.6.1

           ./configure

    如果出现以下情况:

                  Checking for program g++ or c++          : not found

                  Checking for program icpc                : not found

                  Checking for program c++                 : not found

                  /home/admin/pkgs/node-v0.6.10/wscript:261: error: could not configure a cxx compiler!

          

                  解决办法是:

                  安装gcc-c++

                  sudo yum install gcc-c++

          

           如果还有

           Checking for openssl                     : not found

           Checking for function SSL_library_init   : not found

           Checking for header openssl/crypto.h     : not found

           /home/admin/pkgs/node-v0.6.10/wscript:374: error: Could not autodetect OpenSSL support. Make sure OpenSSL

    development packages are installed. Use configure --without-ssl to disable this message.

    解决办法:安装openssl-devel

                  sudo yum install openssl-devel

                  然后,就可以正常编译安装了。

                  ./configure

                  make

                  sudo make install

                 

           node -v可以查看node的相关信息

    2.安装npm

           curl http://npmjs.org/install.sh | sudo sh

           提示网址有问题的话就改为:curl https://npmjs.org/install.sh | sudo sh

          

           如果提示,找不到node,所以:再做一个软链接:

           sudo ln -s /usr/local/bin/node /usr/bin/node

           curl http://npmjs.org/install.sh | sudo sh

           可以正常运行。

    3.安装pixel

    注意(此目录需创建在HTTP目录下)

           sudo npm install pixel-ping

          

           此时会在当前所在目录下生成一个node_modules目录,该文件夹下就是安装的pixel ping的相关文件。

          

    4.配置pixel

           (1)进入node_modules/pixel-ping目录,将config.example.json复制一份,修改config.json文件。重命名为config.json。然后打

    开,修改端口,将host修改为自己的对外的主机地址,如我自己本地虚拟机的是192.168.1.185。修改相应后请求的方法参数endpoint,改为

    http://romy.redidai.com/save_hits.html。如果是上线服务器的话,就改域名可以了,后面的方法保持不动。

           (2)进入node_modules/pixel-ping/lib/下,修改pixel-ping.js文件。

                  修改record方法(9行)。

                  store[key] || (store[key] = 0);此句后面增加的参数代码:

    if (undefined != params.query.ip) {

                         store['ip'] = params.query.ip;

                  }

                 

                  if (undefined != params.query.area) {

                         store['area'] = params.query.area;

                  }

                 

                  if (undefined != params.query.keyword) {

                         store['search'] = params.query.keyword;

                  }

                 

                  if (undefined != params.query.uid) {

                         store['uid'] = params.query.uid;

                  }

                 

                  if (undefined != params.query.referer) {

                         store['referer'] = params.query.referer;

                  }

                 

                  if (undefined != params.query.objClick) {

                         store['objClick'] = params.query.objClick;

    启动命令

    node /home/www/node_modules/pixel-ping/lib/pixel-ping.js /home/www/node_modules/pixel-ping/config.json &

    disown -h %1

    重启

    ps aux | grep node

    kill 掉进程

          

    5.项目主要配置文件修改说明

           (1)在项目的上两级目录(node_modules),dirname(dirname(SITE_PATH)),跟www同级下手动创建log目录,并给与读写权限。

           (2)项目/index.php中增加logs日志文件下载的目录路径定义:

           define('TRACKER_LOGS_DIR',dirname(dirname(SITE_PATH)).'/logs/tracker/');

    //track logs dir

           自己想存到其他盘中,可以手动修改。

           (3)项目/router.inc.php文件中增加路由转向。

           在'index/Index/index' => 'index',后面加上以下一句

           'index/Index/pixel' => 'save_hits',

           (4)在 项目/apps/index/Tpl/default/Index/index.html中添加

           <div class='hitImg'><img src="http://192.168.1.185:9187/pixel.gif?key=index_hit&ip={$clientIP}&area={$area}&uid=

    {$uid}&referer={$httpReferer}&keyword=" alt=""/></div>

           将192.168.1.185改为跟config.json中的一致。

           (5)项目/apps/index/Lib/Action/IndexAction.class.php文件中的pixel()方法就是追踪生成的logs日志方法。

  • 相关阅读:
    android 源码
    android 保护
    电池信息 显示
    RGB、HSB、HSL 互相转换算法
    网页美工
    css 设计标准
    js 封闭 小结
    格式转换工具
    网页设计规范
    瀑布流分析
  • 原文地址:https://www.cnblogs.com/xingmeng/p/4502474.html
Copyright © 2011-2022 走看看