• Linux10.2 安装LNMP


    Nginx安装

      处理静态文件能力更强。

      Nginx官网 nginx.org,最新版1.13,最新稳定版1.12
      Nginx应用场景:web服务、反向代理、负载均衡
      Nginx著名分支,淘宝基于Nginx开发的Tengine,使用上和Nginx一致,服务名,配置文件名都一样,和Nginx的最大区别在于Tenging增加了一些定制化模块,在安全限速方面表现突出,另外它支持对js,css合并
      Nginx核心+lua相关的组件和模块组成了一个支持lua的高性能web容器openresty,参考  http://jinnianshilongnian.iteye.com/blog/2280928

      

      下载并解压安装包

    cd /usr/local/src
    wget http://nginx.org/download/nginx-1.12.1.tar.gz
    tar zxf nginx-1.12.1.tar.g
    

      编译安装

    #自定义安装,无任何参数安装
    [root@localhost nginx-1.12.1]# ./configure --prefix=/usr/local/nginx
    [root@localhost nginx-1.12.1]# make && make install
    
    ./configure: error: the HTTP rewrite module requires the PCRE library.
     
    安装pcre-devel与openssl-devel解决问题
     
    yum -y install pcre-devel openssl openssl-devel

      编辑启动脚本,更改权限

    #编辑启动脚本
    [root@localhost nginx-1.12.1]# vi /etc/init.d/nginx
    #!/bin/bash
    # chkconfig: - 30 21
    # description: http service.
    # Source Function Library
    . /etc/init.d/functions
    # Nginx Settings
    NGINX_SBIN="/usr/local/nginx/sbin/nginx"
    NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
    NGINX_PID="/usr/local/nginx/logs/nginx.pid"
    RETVAL=0
    prog="Nginx"
    start() 
    {
        echo -n $"Starting $prog: "
        mkdir -p /dev/shm/nginx_temp
        daemon $NGINX_SBIN -c $NGINX_CONF
        RETVAL=$?
        echo
        return $RETVAL
    }
    stop() 
    {
        echo -n $"Stopping $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -TERM
        rm -rf /dev/shm/nginx_temp
        RETVAL=$?
        echo
        return $RETVAL
    }
    reload()
    {
        echo -n $"Reloading $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -HUP
        RETVAL=$?
        echo
        return $RETVAL
    }
    restart()
    {
        stop
        start
    }
    configtest()
    {
        $NGINX_SBIN -c $NGINX_CONF -t
        return 0
    }
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      reload)
            reload
            ;;
      restart)
            restart
            ;;
      configtest)
            configtest
            ;;
      *)
            echo $"Usage: $0 {start|stop|reload|restart|configtest}"
            RETVAL=1
    esac
    exit $RETVAL
    
    #更改权限 
    [root@localhost nginx-1.12.1]# chmod 755 /etc/init.d/nginx
    

      开机自启

    [root@localhost nginx-1.12.1]# chkconfig --add nginx
    [root@localhost nginx-1.12.1]# chkconfig nginx on
    

      修改配置文件

    cd /usr/local/nginx/conf/ 
    mv nginx.conf nginx.conf.bak
    
    vim nginx.conf
    user nobody nobody;
    worker_processes 2;
    error_log /usr/local/nginx/logs/nginx_error.log crit;
    pid /usr/local/nginx/logs/nginx.pid;
    worker_rlimit_nofile 51200;
    events
    {
        use epoll;
        worker_connections 6000;
    }
    http
    {
        include mime.types;
        default_type application/octet-stream;
        server_names_hash_bucket_size 3526;
        server_names_hash_max_size 4096;
        log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'
        ' $host "$request_uri" $status'
        ' "$http_referer" "$http_user_agent"';
        sendfile on;
        tcp_nopush on;
        keepalive_timeout 30;
        client_header_timeout 3m;
        client_body_timeout 3m;
        send_timeout 3m;
        connection_pool_size 256;
        client_header_buffer_size 1k;
        large_client_header_buffers 8 4k;
        request_pool_size 4k;
        output_buffers 4 32k;
        postpone_output 1460;
        client_max_body_size 10m;
        client_body_buffer_size 256k;
        client_body_temp_path /usr/local/nginx/client_body_temp;
        proxy_temp_path /usr/local/nginx/proxy_temp;
        fastcgi_temp_path /usr/local/nginx/fastcgi_temp;
        fastcgi_intercept_errors on;
        tcp_nodelay on;
        gzip on;
        gzip_min_length 1k;
        gzip_buffers 4 8k;
        gzip_comp_level 5;
        gzip_http_version 1.1;
        gzip_types text/plain application/x-javascript text/css text/htm 
        application/xml;
        server
        {
            listen 80;
            server_name localhost;
            index index.html index.htm index.php;
            root /usr/local/nginx/html;
            location ~ .php$ 
            {
                include fastcgi_params;
                fastcgi_pass unix:/tmp/php-fcgi.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
            }    
        }
    }
    

      启动服务

     #查看配置文件是否有错误
    /usr/local/nginx/sbin/nginx -t
    
    #启动服务
     /etc/init.d/nginx  start
     netstat -lntp |grep 80
    

      php解析是因为在nginx配置文件中service部分配置了location ~ .php$ 语句,可以自行测试是否解析php。

    [root@localhost ~]# vi /usr/local/nginx/html/1.php
    <?php
        echo "test php scripts.";
    ?>
    [root@localhost ~]# curl localhost/1.php
    test php scripts.

    安装nginx

    yum安装

        yum安装。使用nginx扩展源安装nginx,epel里面的nginx版本太老,先禁用了epel。

    [root@localhost ~]# cat /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
    

      看下所有nginx的安装包

    [root@localhost ~]# yum list |grep nginx
    https://mirrors.ustc.edu.cn/epel/7/x86_64/repodata/d51f5143ca1af84a289a105797cbd21b79d354d68842e80454dcbbdc9783db7e-updateinfo.xml.bz2: [Errno 14] HTTPS Error 404 - Not Found
    正在尝试其它镜像。
    https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/7/x86_64/repodata/a645c8172833961741e3cee02d5c531b796bdc433557a331bafa53b04cb94c0e-primary.xml.gz: [Errno 14] curl#35 - "Peer reports incompatible or unsupported protocol version."
    正在尝试其它镜像。
    collectd-nginx.x86_64                    5.8.0-4.el7                   epel
    munin-nginx.noarch                       2.0.33-1.el7                  epel
    nextcloud-nginx.noarch                   10.0.4-2.el7                  epel
    nginx.x86_64                             1:1.14.0-1.el7_4.ngx          nginx
    nginx-all-modules.noarch                 1:1.12.2-2.el7                epel
    nginx-debug.x86_64                       1:1.8.0-1.el7.ngx             nginx
    nginx-debuginfo.x86_64                   1:1.14.0-1.el7_4.ngx          nginx
    nginx-filesystem.noarch                  1:1.12.2-2.el7                epel
    nginx-mod-http-geoip.x86_64              1:1.12.2-2.el7                epel
    nginx-mod-http-image-filter.x86_64       1:1.12.2-2.el7                epel
    nginx-mod-http-perl.x86_64               1:1.12.2-2.el7                epel
    nginx-mod-http-xslt-filter.x86_64        1:1.12.2-2.el7                epel
    nginx-mod-mail.x86_64                    1:1.12.2-2.el7                epel
    nginx-mod-stream.x86_64                  1:1.12.2-2.el7                epel
    nginx-module-geoip.x86_64                1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-geoip-debuginfo.x86_64      1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-image-filter.x86_64         1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-image-filter-debuginfo.x86_64
                                             1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-njs.x86_64                  1:1.14.0.0.2.2-1.el7_4.ngx    nginx
    nginx-module-njs-debuginfo.x86_64        1:1.14.0.0.2.2-1.el7_4.ngx    nginx
    nginx-module-perl.x86_64                 1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-perl-debuginfo.x86_64       1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-xslt.x86_64                 1:1.14.0-1.el7_4.ngx          nginx
    nginx-module-xslt-debuginfo.x86_64       1:1.14.0-1.el7_4.ngx          nginx
    nginx-nr-agent.noarch                    2.0.0-12.el7.ngx              nginx
    owncloud-nginx.noarch                    9.1.5-1.el7                   epel
    pcp-pmda-nginx.x86_64                    3.12.2-5.el7                  base
    python2-certbot-nginx.noarch             0.25.1-1.el7                  epel
    

      其中epel源的都比较老,先禁用了。

    [root@localhost ~]# mv /etc/yum.repos.d/epel.repo  /etc/yum.repos.d/epel.repo.bak
    [root@localhost ~]# yum list |grep nginx                                        nginx.x86_64                               1:1.14.0-1.el7_4.ngx        nginx
    nginx-debug.x86_64                         1:1.8.0-1.el7.ngx           nginx
    nginx-debuginfo.x86_64                     1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-geoip.x86_64                  1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-geoip-debuginfo.x86_64        1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-image-filter.x86_64           1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-image-filter-debuginfo.x86_64 1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-njs.x86_64                    1:1.14.0.0.2.2-1.el7_4.ngx  nginx
    nginx-module-njs-debuginfo.x86_64          1:1.14.0.0.2.2-1.el7_4.ngx  nginx
    nginx-module-perl.x86_64                   1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-perl-debuginfo.x86_64         1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-xslt.x86_64                   1:1.14.0-1.el7_4.ngx        nginx
    nginx-module-xslt-debuginfo.x86_64         1:1.14.0-1.el7_4.ngx        nginx
    nginx-nr-agent.noarch                      2.0.0-12.el7.ngx            nginx
    pcp-pmda-nginx.x86_64                      3.12.2-5.el7                base
    

      直接yum安装,再启动(安装最稳定最新的nginx)

    [root@localhost ~]# yum install -y nginx
    [root@localhost ~]# systemctl start nginx
    [root@localhost ~]# netstat -lnpt
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1928/master
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3070/nginx: master
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1091/sshd
    tcp6       0      0 ::1:25                  :::*                    LISTEN      1928/master
    tcp6       0      0 :::22                   :::*                    LISTEN      1091/sshd
    [root@localhost ~]# ps aux|grep nginx
    root      3070  0.0  0.0  48976   976 ?        Ss   21:28   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
    nginx     3071  0.0  0.1  49380  1932 ?        S    21:28   0:00 nginx: worker process
    root      3075  0.0  0.0 112656   992 pts/1    R+   21:28   0:00 grep --color=auto nginx
    

      测试:浏览器访问或者curl,用浏览器前需要禁用Iptables,或者把iput80端口全部放行

    [root@localhost ~]# iptables -F
    [root@localhost ~]# systemctl stop firewalld
    [root@localhost ~]# curl http://192.168.212.131/
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>

       查看nginx安装目录,编译参数等

    [root@localhost ~]# nginx -V
    nginx version: nginx/1.14.0
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
    

    源码安装

      需要特殊需求或者不能使用Yum的系统。

    [root@localhost src]# wget http://nginx.org/download/nginx-1.14.0.tar.gz
    [root@localhost src]# tar zxf nginx-1.14.0.tar.gz
    [root@localhost src]# cd nginx-1.14.0
    [root@localhost nginx-1.14.0]# ls
    auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
    
    //查看编译参数
    
    [root@localhost nginx-1.14.0]# ./configure --help  
    
      --help                             print this message
    
      --prefix=PATH                      set installation prefix
      --sbin-path=PATH                   set nginx binary pathname
      --modules-path=PATH                set modules path
      --conf-path=PATH                   set nginx.conf pathname
      --error-log-path=PATH              set error log pathname
      --pid-path=PATH                    set nginx.pid pathname
      --lock-path=PATH                   set nginx.lock pathname
    ... ...
    
    [root@localhost nginx-1.12.1]# make && make install
      编辑启动脚本,更改权限
    
    #编辑启动脚本
    [root@localhost nginx-1.12.1]# vi /etc/init.d/nginx
    #!/bin/bash
    # chkconfig: - 30 21
    # description: http service.
    # Source Function Library
    . /etc/init.d/functions
    # Nginx Settings
    NGINX_SBIN="/usr/local/nginx/sbin/nginx"
    NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
    NGINX_PID="/usr/local/nginx/logs/nginx.pid"
    RETVAL=0
    prog="Nginx"
    start() 
    {
        echo -n $"Starting $prog: "
        mkdir -p /dev/shm/nginx_temp
        daemon $NGINX_SBIN -c $NGINX_CONF
        RETVAL=$?
        echo
        return $RETVAL
    }
    stop() 
    {
        echo -n $"Stopping $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -TERM
        rm -rf /dev/shm/nginx_temp
        RETVAL=$?
        echo
        return $RETVAL
    }
    reload()
    {
        echo -n $"Reloading $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -HUP
        RETVAL=$?
        echo
        return $RETVAL
    }
    restart()
    {
        stop
        start
    }
    configtest()
    {
        $NGINX_SBIN -c $NGINX_CONF -t
        return 0
    }
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      reload)
            reload
            ;;
      restart)
            restart
            ;;
      configtest)
            configtest
            ;;
      *)
            echo $"Usage: $0 {start|stop|reload|restart|configtest}"
            RETVAL=1
    esac
    exit $RETVAL
    
    #更改权限 
    [root@localhost nginx-1.12.1]# chmod 755 /etc/init.d/nginx
      开机自启
    
    [root@localhost nginx-1.12.1]# chkconfig --add nginx
    [root@localhost nginx-1.12.1]# chkconfig nginx on
    

    Nginx配置文件

      

    安装MySQL

      若之前服务器有mysql,再次安装需要把之前mysql删除干净。MySQL数据文件夹可删可不删

    #删除分三步
    #先删除MySQL文件包
    rm -rf /usr/local/mysql
    
    #再删除启动文件
    rm -rf /etc/init.d/mysqld
    
    #删除配置文件
    rm -rf  /etc/my.cnf
    

      之后为安装MySQL,首先下载mysql二进制免编译包

    [root@localhost src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
    

      再解压该二进制免编译包。

    [root@localhost src]# tar -zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
    

      移动解压后的文件,移动前确认目标地无MySQL文件夹

    [root@localhost src]# ls /usr/local/mysql
    ls: 无法访问/usr/local/mysql: 没有那个文件或目录
    [root@localhost src]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
    

      创建MySQL数据文件夹,并创建mysql用户

     useradd mysql
     mkdir /data/
    

      编译安装mysql,出现两个OK则成功

     ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
    

      安装会出现一些错误

    #error 1
    [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
    Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    
    #解决办法
    [root@localhost mysql]# yum install -y libaio
    
    
    #error 2
    [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
    -bash: ./scripts/mysql_install_db: /usr/bin/perl: 坏的解释器: 没有那个文件或目录
    
    #解决办法
    [root@localhost mysql]# yum -y install autoconf
    
    再次编译安装,验证输出
    [root@localhost mysql]# echo $?
    0
    

      拷贝配置文件和启动脚本

    #配置文件
    [root@localhost mysql]# cp ./support-files/my-default.cnf  /etc/my.cnf 
    
    
    #启动脚本
    [root@localhost mysql]# cp ./support-files/mysql.server /etc/init.d/mysqld
    

      修改配置文件和启动脚本,主要修改这两项

    basedir
    datadir
    

      修改启动脚本权限为755,开机自启

    [root@localhost mysql]# chmod 755 /etc/init.d/mysqld
    [root@localhost mysql]# chkconfig --add mysqld
    

      启动MySQL

    [root@localhost mysql]# /etc/init.d/mysqld start
    Starting MySQL.Logging to '/data/mysql/localhost.localdomain.err'.
    . SUCCESS! 
    

      命令行方式启动

    /usr/local/mysql/bin/mysqld_safe    --default-file=/etc/my.cnf  --user=mysql  --data=/data/mysql
    

      杀进程可以用killall mysqld,系统会继续等待mysql传输数据,直到全部完成才会自动关闭。

      在mysqld写数据的时候,如果杀死mysqld进程,发现杀不死,不要强制-9杀,有可能会直接导致正在传输的数据丢失,表损坏。

    安装PHP

       和LAMP安装PHP方法有差别,需要开启php-fpm服务

      下载php源码包

    [root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
    

      解压

    [root@localhost src]# tar zxf php-5.6.30.tar.gz 
    

      创建用户

    useradd -s /sbin/nologin php-fpm
    

      编译安装

     ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl  --with-openssl
    

      安装错误见LAMP文件,其中未包含的错误有以下

    configure: error: Please reinstall the libcurl distribution -
        easy.h should be in <curl-dir>/include/curl/
    
    #解决方法
    
    yum install -y curl curl-devel
    

      最后make && make install  可能需要10分钟左右。

      安装成功后

      查看php文件发现,LAMP和LNMP的php文件是有区别的

    #LNMP
    [root@localhost php-5.6.30]# ls /usr/local/php-fpm/
    bin  etc  include  lib  php  sbin  var
    #多一个sbin和var文件
    #sbin文件是存放php服务启动文件
    [root@localhost php-5.6.30]# ls /usr/local/php-fpm/sbin/
    php-fpm
    #var里面放的是日志文件和存放pid
    [root@localhost php-5.6.30]# ls /usr/local/php-fpm/var/
    log  run
    
    #LAMP
    [root@chy002 ~]# ls /usr/local/php/
    bin  etc  include  lib  php
    

      -m 查看模块,-i 查看phpinfo,-t查看配置文件是否正确

    #两个都可以
    
    [root@localhost php-5.6.30]# /usr/local/php-fpm/bin/php  -m
    
    [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm  -m
    

      拷贝修改配置文件,php.ini用来控制php某些功能

    #拷贝生产环境下配置文件
    [root@localhost etc]# cp php.ini-production /usr/local/php-fpm/etc/php.ini
    
    #修改配置文件
    [root@localhost etc]# mv php-fpm.conf.default php-fpm.conf
    
    [root@localhost etc]#vi /usr/local/php/etc/php-fpm.conf
    [global]
    pid = /usr/local/php-fpm/var/run/php-fpm.pid
    error_log = /usr/local/php-fpm/var/log/php-fpm.log
    [www]
    listen = /tmp/php-fcgi.sock
    listen.mode = 666
    user = php-fpm
    group = php-fpm
    pm = dynamic
    pm.max_children = 50
    pm.start_servers = 20
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35
    pm.max_requests = 500
    rlimit_files = 1024
    

      拷贝启动脚本

    [root@localhost etc]# cp /usr/local/src/php-5.6.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    [root@localhost etc]# chmod 755 /etc/init.d/php-fpm
    [root@localhost etc]# chkconfig --add php-fpm
    [root@localhost etc]# chkconfig php-fpm on
    [root@localhost etc]# service php-fpm start
    Starting php-fpm  done 

      检测一下

    [root@localhost etc]# ps aux|grep php
    root     21666  0.0  0.4 124228  4944 ?        Ss   05:31   0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
    php-fpm  21667  0.0  0.4 124228  4704 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21668  0.0  0.4 124228  4704 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21669  0.0  0.4 124228  4704 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21670  0.0  0.4 124228  4704 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21671  0.0  0.4 124228  4708 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21672  0.0  0.4 124228  4708 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21673  0.0  0.4 124228  4708 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21674  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21675  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21676  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21677  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21678  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21679  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21680  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21681  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21682  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21683  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21684  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21685  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    php-fpm  21686  0.0  0.4 124228  4712 ?        S    05:31   0:00 php-fpm: pool www
    root     21688  0.0  0.0 112724   980 pts/0    S+   05:33   0:00 grep --color=auto php
    [root@localhost etc]# ls -l /tmp/php-fcgi.sock 
    srw-rw-rw-. 1 root root 0 5月  15 05:31 /tmp/php-fcgi.sock 
  • 相关阅读:
    重构区块链
    区块链隐私保护技术简单介绍
    Extmail邮件过滤和杀毒
    关于Python的JSON
    关于Python的JSON
    关于Python的JSON
    Tomcat的设置4——Tomcat的体系结构与设置基于端口号的虚拟主机
    Tomcat的设置4——Tomcat的体系结构与设置基于端口号的虚拟主机
    Tomcat的设置4——Tomcat的体系结构与设置基于端口号的虚拟主机
    Tomcat的设置4——Tomcat的体系结构与设置基于端口号的虚拟主机
  • 原文地址:https://www.cnblogs.com/chyuanliu/p/9038647.html
Copyright © 2020-2023  润新知