安装php,nginx 带debug

gdb安装包
 

在CentOS6.4下使用gdb进行调试的时候,

使用bt(breaktrace)命令时,会弹出如下的提示:

头一天提示:

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.i686

问题没解决,第二天提示:

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686

但是直接按提示使用 debuginfo-install glibc-2.12-1.132.el6.i686 去安装的时候会报如下的信息:

 

Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * updates: mirrors.yun-idc.com
Checking for new repos for mirrors
No debuginfo packages available to install

 

使用yum来进行安装:

 

 sudo yum --nogpgcheck --enablerepo=debug install glibc-debuginfo
却提示:Error Downloading Packages:
  glibc-debuginfo-common-2.12-1.132.el6.i686: failure: glibc-debuginfo-common-2.12-1.132.el6.i686.rpm from debug: [Errno 256] No more mirrors to try.
使用yum install glibc安装,发现只是安装了一些基本库,不包含 glibc-debuginfo
后来搜索发现需要先修改“/etc/yum.repos.d/CentOS-Debuginfo.repo”文件的enable=1
文件内容如下:
[plain] view plaincopy在CODE上查看代码片派生到我的代码片
 
  1. # CentOS-Debug.repo  
  2. #  
  3. # The mirror system uses the connecting IP address of the client and the  
  4. # update status of each mirror to pick mirrors that are updated to and  
  5. # geographically close to the client.  You should use this for CentOS updates  
  6. # unless you are manually picking other mirrors.  
  7. #  
  8.   
  9. # All debug packages from all the various CentOS-5 releases  
  10. # are merged into a single repo, split by BaseArch  
  11. #  
  12. # Note: packages in the debuginfo repo are currently not signed  
  13. #  
  14.   
  15. [debug]  
  16. name=CentOS-6 - Debuginfo  
  17. baseurl=http://debuginfo.centos.org/6/$basearch/  
  18. gpgcheck=1  
  19. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6  
  20. enabled=1  
保存之后,使用 debuginfo-install glibc-2.12-1.132.el6.i686 安装,输出如下:
[plain] view plaincopy在CODE上查看代码片派生到我的代码片
 
  1. Loaded plugins: fastestmirror, refresh-packagekit  
  2. Loading mirror speeds from cached hostfile  
  3.  * base: mirrors.yun-idc.com  
  4.  * extras: mirrors.yun-idc.com  
  5.  * updates: mirrors.yun-idc.com  
  6. debug                                                                                                                                 | 2.5 kB     00:00       
  7. Checking for new repos for mirrors  
  8. --> Running transaction check  
  9. ---> Package glibc-debuginfo.i686 0:2.12-1.132.el6 will be installed  
  10. --> Processing Dependency: glibc-debuginfo-common = 2.12-1.132.el6 for package: glibc-debuginfo-2.12-1.132.el6.i686  
  11. ---> Package nss-softokn-debuginfo.i686 0:3.12.9-11.el6 will be installed  
  12. ---> Package yum-plugin-auto-update-debug-info.noarch 0:1.1.30-17.el6_5 will be installed  
  13. --> Running transaction check  
  14. ---> Package glibc-debuginfo-common.i686 0:2.12-1.132.el6 will be installed  
  15. --> Finished Dependency Resolution  
  16.   
  17. Dependencies Resolved  
  18.   
  19. =============================================================================================================================================================  
  20.  Package                                                Arch                        Version                               Repository                    Size  
  21. =============================================================================================================================================================  
  22. Installing:  
  23.  glibc-debuginfo                                        i686                        2.12-1.132.el6                        debug                         10 M  
  24.  nss-softokn-debuginfo                                  i686                        3.12.9-11.el6                         debug                        1.0 M  
  25.  yum-plugin-auto-update-debug-info                      noarch                      1.1.30-17.el6_5                       updates                       22 k  
  26. Installing for dependencies:  
  27.  glibc-debuginfo-common                                 i686                        2.12-1.132.el6                        debug                        7.5 M  
  28.   
  29. Transaction Summary  
  30. =============================================================================================================================================================  
  31. Install       4 Package(s)  
  32.   
  33. Total size: 19 M  
  34. Total download size: 8.6 M  
  35. Installed size: 93 M  
  36. Is this ok [y/N]: y  
  37. Downloading Packages:  
  38. (1/3): glibc-debuginfo-common-2.12-1.132.el6.i686.rpm                                                                                 | 7.5 MB     12:03       
  39. (2/3): nss-softokn-debuginfo-3.12.9-11.el6.i686.rpm                                                                                   | 1.0 MB     01:56       
  40. (3/3): yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch.rpm                                                                   |  22 kB     00:00       
  41. -------------------------------------------------------------------------------------------------------------------------------------------------------------  
  42. Total                                                                                                                         10 kB/s | 8.6 MB     14:10       
  43. Running rpm_check_debug  
  44. Running Transaction Test  
  45. Transaction Test Succeeded  
  46. Running Transaction  
  47.   Installing : glibc-debuginfo-common-2.12-1.132.el6.i686                                                                                                1/4   
  48.   Installing : glibc-debuginfo-2.12-1.132.el6.i686                                                                                                       2/4   
  49.   Installing : yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch                                                                                  3/4   
  50.   Installing : nss-softokn-debuginfo-3.12.9-11.el6.i686                                                                                                  4/4   
  51.   Verifying  : glibc-debuginfo-common-2.12-1.132.el6.i686                                                                                                1/4   
  52.   Verifying  : nss-softokn-debuginfo-3.12.9-11.el6.i686                                                                                                  2/4   
  53.   Verifying  : glibc-debuginfo-2.12-1.132.el6.i686                                                                                                       3/4   
  54.   Verifying  : yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch                                                                                  4/4   
  55.   
  56. Installed:  
  57.   glibc-debuginfo.i686 0:2.12-1.132.el6      nss-softokn-debuginfo.i686 0:3.12.9-11.el6      yum-plugin-auto-update-debug-info.noarch 0:1.1.30-17.el6_5       
  58.   
  59. Dependency Installed:  
  60.   glibc-debuginfo-common.i686 0:2.12-1.132.el6                                                                                                                 
  61.   
  62. Complete!  
OK,问题解决。

第二次安装总结:
1、需要先修改“/etc/yum.repos.d/CentOS-Debuginfo.repo”文件的enable=1;
2、使用 sudo yum install glibc 安装;
3、使用 debuginfo-install glibc-2.12-1.132.el6.i686 安装。
测试,安装成功。

下面不太好了

yum --nogpgcheck --enablerepo=debug install glibc-debuginfo cyrus-sasl-debuginfo keyutils-debuginfo krb5-debuginfo libselinux-debuginfo libssh2-debuginfo libxml2-debuginfo nspr-debuginfo nss-debuginfo nss-softokn-debuginfo nss-util-debuginfo openldap-debuginfo openssl-debuginfo zlib-debuginfo

rpm -ivh libidn-debuginfo-1.32-1.fc23.x86_64.rpm
http://rpmfind.net/linux/rpm2html/search.php?query=libidn-debuginfo(x86-64)

https://www.baidu.com/link?url=Mf_Pi0CDxpjkpHoqOYE2Sp9FkSSWvTVMqgsyG0JhS0dN7TvMScKifI1X-oGAIYpkCVpz8WVi3kOvMKumYj_YLHCxtSUV5wnYUH3kDHbpYFn-4xuxLT5Jh0LkxIvLxHpIvaJolYiem858JvSxCME98vuz-ZSToSf3IxdmZwvAWxq&wd=&eqid=aaf78b5000018cbb00000002564edc55

 

 http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3118061.html


1.安装PCRE库
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38 && ./configure && make && make install



2.安装zlib库
cd /usr/local/
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz && cd zlib-1.2.8
./configure && make && make install

3.安装ssl

cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz && cd openssl-1.0.1c
./config && make && make install
若出现 recipe for target 'install_docs' failed
make && make install_sw


4.安装nginx

Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz && cd nginx-1.2.8 

./configure --prefix=/usr/local/nginx  --with-pcre=/home/source/
pcre-8.39 --with-zlib=/home/source/zlib-1.2.8 && make && make install
 
寻找nginx
whereis nginx
/usr/local/nginx/sbin/nginx 启动

--with-pcre=/usr/src/pcre-8.21 指的是pcre-8.21 的源码路径。
--with-zlib=/usr/src/zlib-1.2.7 指的是zlib-1.2.7 的源码路径。

编译器默认没有把宏定义扩展信息编译进二进制文件。

编译时需添加-gdwarf-2和-g3两个参数。

加了-g3的参数后,gcc编译的时候,会将扩展的debug 信息编译进二进制文件里面,包括宏定义信息。

结论:

在CFLAGS参数后添加-g3 -gdwarf-2参数
 
修改配置文件
vi /usr/local/nginx/conf/nginx.conf
file not found 参考 这里 这里 
 
user  www; //这里要和php-fpm用同一个用户名 useradd www;groupadd -g www www
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/www;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           /home/www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/www/$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

 

 为方便nginx启动,重启

touch /etc/init.d/nginx

chmod +x /etc/init.d/nginx

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi
   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL
}
# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid
}
# reload nginx service functions.
reload() {
    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo
}
# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        reload
        ;;
restart)
        stop
        start
        ;;
status)
        status $prog
        RETVAL=$?
        ;;

*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac
exit $RETVAL

 

 

安装php
wget http://hk2.php.net/get/php-5.5.38.tar.gz/from/this/mirror
tar zvxf php-5.5.38.tar.gz && 
cd php-5.5.38
yum install libxml2
yum install libxml2-devel
CFLAGS="-g -gdwarf-2 -g3" CXXFLAGS="-g -gdwarf-2 -g3" ./configure --prefix=/usr/local/php --enable-fpm --enable-socket --enable-pdo --with-curl --enable-debug --enable-opcache

make all install
 
复制php配置文件
cp  /home/source/php-5.5.38/php.productoin   /usr/local/php/lib/php.ini


6.配置php-fpm
cd /usr/local/php
cp etc/php-fpm.conf.default etc/php-fpm.conf
cp php.ini-development /usr/local/php/lib/php.ini
vi etc/php-fpm.conf

修改
user = www-data
group = www-data

如果www-data用户不存在,那么先添加www-data用户
groupadd www-data
useradd -g www-data www-data
 
#启动php-fpm
/usr/local/php/sbin/php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
 
 
打开pid = run/php-fpm.pid前的注释,这样fpm的进程就会被写入这个文件:/usr/local/php5/var/run/php-fpm.pid
vi /etc/profile
PATH=$PATH:/usr/local/php/bin
 
命令行下执行php,提示找不到命令

-bash: /usr/bin/php: No such file or directory

vi /etc/profile

在文件底部增加一行配置
export PATH=/usr/local/php/bin:$PATH

保存退出

source /etc/profile
 
为了方便启动,重启php-fpm,在/etc/init.d/php-fpm使用
cp /home/source/php-5.5.38/sapi/fpm/init.d.php-fpm   /etc/init.d/php-fpm
chmod  +x /etc/init.d/php-fpm
 
如果忘记--enable-socket
则可以 
cd /home/source/php-5.5.38/ext/sockets

./configure --prefix=/usr/local/php --with-php-config=/usr/local/php/bin/php-config --enable-sockets

make && make install

 
 主机和虚拟机通过nat连接
主机访问虚拟机里的nginx时,一定要把虚拟主机的iptable关掉,不然打不开
/etc/init.d/iptables stop
 
 
 
php 5.4.7 下的php-fpm 不再支持 php-fpm 以前具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:

master进程可以理解以下信号

INT, TERM 立刻终止 QUIT 平滑终止 USR1 重新打开日志文件 USR2 平滑重载所有worker进程并重新载入配置和二进制模块

示例:

php-fpm 关闭:

kill -INT `cat /usr/local/php/var/run/php-fpm.pid`

php-fpm 重启:

kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

6.1安装bison以及re2c
 
zend_ini_parser.c 1110行 
int yydebug;
改为
int yydebug=1;
 
 如果更改了zend_language_parse.y和zend_language_scanner.l的话,
删除掉zend_language_parse.c以及zend_language_scanner.c,再make时,会报错,需要安装bison,re2c
 
bison
 
tar -xvzf bison-2.6.4.tar.gz 

cd bison-2.6.4

./configure

make 

sudo make install
 
re2c  不要用re2c.14这个版本,不然安装php.6.6时会报错,zend_language_scanner.l不存在

# tar xf re2c-0.13.7.5.tar.gz

# cd re2c-0.13.7.5

# ./configure

#make && make install



php-fpm 5.4.7 如何关闭 重启?



查看php-fpm进程数:

ps aux | grep -c php-fpm



6 zend opcache

[opcache]
zend_extension = /data/app/php5/lib/php/extensions/no-debug-zts-20121212/opcache.so
opcache.enable=1
opcache.memory_consumption = 64
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
opcache.fast_shutdown = 1
opcache.enable_cli = 1


7.启动
确保系统的 80 端口没被其他程序占用,
/usr/local/nginx/sbin/nginx

检查是否启动成功:
netstat -ano|grep 80 有结果输入说明启动成功


打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

7.重启
/usr/local/nginx/sbin/nginx –s reload

8.修改配置文件
cd /usr/local/nginx/conf
vi nginx.conf

9.常用配置
#nginx运行用户和组
user    www www; 
#启动进程,通常设置成和cpu的数量相等
worker_processes  4;

#全局错误日志及PID文件
pid /var/run/nginx.pid;
error_log  /var/log/nginx/error.log;

events {
        #epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能
use epoll;
                   #单个后台worker process进程的最大并发链接数
        worker_connections  10240;
}
#设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
        include       mime.types;

        default_type  application/octet-stream;

         error_page 400 403 500 502 503 504  /50x.html;

        index index.html index.shtml

        autoindex off;

         fastcgi_intercept_errors on;

        sendfile        on;

        # These are good default values.
        tcp_nopush      on;
        tcp_nodelay     off;

        # output compression saves bandwidth
        gzip  off;
         #gzip_static on;
        #gzip_min_length  1k;
        gzip_http_version 1.0;
        gzip_comp_level 2;
        gzip_buffers  4 16k;
        gzip_proxied any;
        gzip_disable "MSIE [1-6]\.";
        gzip_types  text/plain text/html text/css application/x-javascript application/xml application/xml+rss text/javascript;
        #gzip_vary on;

        server_name_in_redirect off;

#设定负载均衡的服务器列表
        upstream portals {
                  server 172.16.68.134:8082 max_fails=2 fail_timeout=30s;
                  server 172.16.68.135:8082 max_fails=2 fail_timeout=30s;
                            server 172.16.68.136:8082 max_fails=2 fail_timeout=30s;
                  server 172.16.68.137:8082 max_fails=2 fail_timeout=30s;
        }

        #upstream overflow {
         #       server 10.248.6.34:8090 max_fails=2 fail_timeout=30s;      
         #       server 10.248.6.45:8080 max_fails=2 fail_timeout=30s;      
        #}

        server {
                                     #侦听8080端口
                listen       8080;
                server_name  127.0.0.1;

                   #403、404页面重定向地址
                   error_page  403 = http://www.e100.cn/ebiz/other/217/403.html;
                   error_page  404 = http://www.e100.cn/ebiz/other/218/404.html;
                   proxy_connect_timeout      90;
                   proxy_send_timeout         180;
                   proxy_read_timeout         180;

                   proxy_buffer_size 64k;
                   proxy_buffers 4 128k;
                   proxy_busy_buffers_size 128k;


                   client_header_buffer_size 16k;
                   large_client_header_buffers 4 64k;

                #proxy_send_timeout         3m;
                #proxy_read_timeout         3m;
                #proxy_buffer_size          4k;
                #proxy_buffers              4 32k;

                proxy_set_header Host $http_host;
                proxy_max_temp_file_size 0;
                #proxy_hide_header Set-Cookie;
                 
         #       if ($host != 'www.e100.cn' ) {
         #                rewrite ^/(.*)$ http://www.e100.cn/$1 permanent;
         #       }


               location / {
                       deny all;
               }

                   location ~ ^/resource/res/img/blue/space.gif {
                    proxy_pass http://tecopera;
               }

               location = / {
                   rewrite ^(.*)$  /ebiz/event/517.html last;
               }



                   location = /ebiz/event/517.html {
                    add_header Vary Accept-Encoding;
                    root /data/web/html;
                    expires 10m;
               }




               location = /check.html {
                    root /usr/local/nginx/html/;
                    access_log off;
               }

               location = /50x.html {
                    root /usr/local/nginx/html/;
                    expires 1m;
                    access_log off;
               }


              location = /index.html {
                       add_header Vary Accept-Encoding;
#定义服务器的默认网站根目录位置
                    root /data/web/html/ebiz;
                    expires 10m;
               }
#定义反向代理访问名称
                   location ~ ^/ecps-portal/* {
                   # expires 10m;
#重定向集群名称
                    proxy_pass http://portals;
                    #proxy_pass http://172.16.68.134:8082;
               }

                   location ~ ^/fetionLogin/* {
                   # expires 10m;
                    proxy_pass http://portals;
                    #proxy_pass http://172.16.68.134:8082;
                }

                   #location  ~ ^/business/* {                                                                     
                #   # expires 10m;                                                                               
                #    proxy_pass http://172.16.68.132:8088;                                                                  
                #    #proxy_pass http://172.16.68.134:8082;                                                      
                #}

                   location ~ ^/rsmanager/* {
                    expires 10m;
                    root /data/web/;
                    #proxy_pass http://rsm;
               }
#定义nginx处理的页面后缀
                   location ~* (.*)\.(jpg|gif|htm|html|png|js|css)$  {
                            root /data/web/html/;
#页面缓存时间为10分钟
                         expires 10m;
                   }

#设定查看Nginx状态的地址    
               location ~* ^/NginxStatus/ {
                    stub_status on;
                    access_log off;
                    allow 10.1.252.126;
                    allow 10.248.6.49;
                    allow 127.0.0.1;
                    deny all;
               }
         #       error_page   405 =200 @405;
         #       location @405
         #       {
         #                proxy_pass http://10.248.6.45:8080;
         #       } 

               access_log  /data/logs/nginx/access.log combined;
               error_log   /data/logs/nginx/error.log;
        }
         server {
                listen       8082;

                server_name  _;
               location = /check.html {
                    root /usr/local/nginx/html/;
                    access_log off;
               }
                 
        }
         server {
                   listen       8088;
                   server_name  _;
                   location ~ ^/* {
                   root /data/web/b2bhtml/;
                   access_log off;
         }               
         }
        server {
                listen       9082;
                server_name  _;

        #        location ~ ^/resource/* {
        #            expires 10m;
         #           root /data/web/html/;
         #       }

                location  / {
                     root /data/web/html/sysMaintain/;
                       if (!-f $request_filename) {
                            rewrite ^/(.*)$ /sysMaintain.html last;
                           }
                }
        }

}
 

首先要找到php-fpm.conf配置文件,查看pid的配置路径(不是安装路径),然后把下面对应的地方改掉才能正常执行。

[root@DO-SG-H1 ~]# ps aux | grep php-fpm   
root     11799  0.0  0.0 103248   880 pts/0    S+   13:51   0:00 grep --color php-fpm
root     11973  0.0  0.0 417748   964 ?        Ss   Jun01   0:20 php-fpm: master process (/etc/php-fpm.conf)

cat /etc/php-fpm.conf
看到
pid = /var/run/php-fpm/php-fpm.pid

php-fpm 启动:
/usr/local/php/sbin/php-fpm
php-fpm 关闭:
kill -INT `cat /var/run/php-fpm/php-fpm.pid`
php-fpm 重启:
kill -USR2 `cat /var/run/php-fpm/php-fpm.pid`

查看php-fpm进程数:
ps aux | grep -c php-fpm

=============================

[root@DO-SG-H1 ~]# find / -name 'php-fpm' -type d
/var/log/php-fpm
/var/run/php-fpm

用这个find命令查找出来的路径是不对的

 which php
/usr/bin/php

 

posted @ 2015-11-22 14:23  taek  阅读(1104)  评论(0编辑  收藏  举报