lizh 发表于 2018-12-19 07:25:05

Tengine2.1.0 + php5.5.25 + Mysql 5.5.42 安装

  安装Tengine

#yum安装pcre库
yum install pcre-devel openssl openssl-devel zlib -y
#创建运行账号
useradd -s /sbin/nologin -M www
#下载并安装
wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz
tar zxf tengine-2.1.0.tar.gz
cd tengine-2.1.0
./configure --prefix=/apps/tengine
make && make install
#nginx.conf 参考
====================================================
userwww www;
worker_processes   auto;
worker_cpu_affinityauto;
error_log/data/logs/nginx/error.logcrit;
pid      /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events
{
    use epoll;
    worker_connections 51200;
}
http
{
    include       mime.types;
    default_typeapplication/octet-stream;
    server_tokens off;
    server_tag TWS;
    reset_timedout_connection       on;
    keepalive_timeout               120;
    keepalive_requests            100;
    sendfile on;
    tcp_nodelay on;
    tcp_nopushoff;
    ignore_invalid_headers          on;
    server_names_hash_max_size      256;
    server_names_hash_bucket_size   64;
    client_header_buffer_size 8k;
    large_client_header_buffers 4 32k;
    client_max_body_size 50m;
    client_body_buffer_size256k;
    connection_pool_size            256;
    request_pool_size               64k;
    output_buffers                  2 128k;
    postpone_output               1460;
    client_header_timeout         1m;
    client_body_timeout             3m;
    send_timeout                  3m;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
    gzip on;
    gzip_min_length1k;
    gzip_buffers   4 32k;
    gzip_http_version 1.1;
    gzip_comp_level 4;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    log_format main'$remote_addr - $remote_user [$time_local] "$request" '
            '$status $body_bytes_sent "$http_referer" '
            '"$http_user_agent" "$http_x_forwarded_for" $request_time';
    open_log_file_cache               max=1000 inactive=20s min_uses=1 valid=1m;
    server {
      listen 80;
      server_name test.cnyang.com;
      access_log /data/logs/nginx/test.cnyang.access.log main;
      index index.php index.html index.html;
      root /data/site/test.cnyang.com;
      location /
      {
            try_files $uri $uri/ /index.php?$args;
      }
      location ~ .*\.(php)?$
      {
            expires -1s;
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include fastcgi_params;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_passunix:/dev/shm/php-fcgi.sock;#和后面的php-fpm配置结合使用(通过sock方式与php连接)
      }
      location /nstu {
            stub_status on;
            access_log   off;
         #allow 172.16.50.0/24;
         #deny all;
      }
      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires      30d;
      }
      location ~ .*\.(js|css)?$ {
            expires      12h;
      }
    }
}
====================================================
  安装php
#需要有www用户
useradd -s /sbin/nologin -M www
#yum解决依赖包问题。
yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y
#下载php
wget http://cn2.php.net/distributions/php-5.5.25.tar.bz2
#解压并编译安装
tar -xjf php-5.5.25.tar.bz2
cd php-5.5.25
./configure --prefix=/apps/php --with-config-file-path=/apps/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --enable-opcache --with-fpm-user=www --with-fpm-group=www --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64
make ZEND_EXTRA_LIBS='-liconv'
make install
#修改配置文件
cp php.ini-production /apps/php/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /apps/php/etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 32M/g' /apps/php/etc/php.ini
sed -i 's#;date.timezone =.*#date.timezone = Asia/Shanghai#g' /apps/php/etc/php.ini
#开启Opcache
sed -i 's/;opcache.enable=0/opcache.enable=1/g' /apps/php/etc/php.ini
sed -i '/opcache.enable=1/azend_extension = "opcache.so"' /apps/php/etc/php.ini
sed -i 's/;opcache.enable_cli=0/opcache.enable_cli=1/g' /apps/php/etc/php.ini
sed -i 's/;opcache.memory_consumption=64/opcache.memory_consumption=128/g' /apps/php/etc/php.ini
sed -i 's/;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=2000/g' /apps/php/etc/php.ini
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=240/g' /apps/php/etc/php.ini
sed -i 's/expose_php = On/expose_php = Off/g' /apps/php/etc/php.ini#禁止显示版本信息
#禁用一些较危险的函数。
sed -i 's/disable_functions =/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname/g' /apps/php/etc/php.ini
cat >/apps/php/etc/php-fpm.conf
页: [1]
查看完整版本: Tengine2.1.0 + php5.5.25 + Mysql 5.5.42 安装