LNMP centos6.7+nginx1.9.12+mysql5.7.11+php5.6.13+PHP各项扩展安装 以及openresty nginx+lua环境

来源:互联网 发布:自身投资知乎 编辑:程序博客网 时间:2024/05/22 06:24
###   依 赖   ###yum groupinstall "Development tools";yum -y install gcc gcc-c++ cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers;### 安装Apache ab测试工具yum install httpd-tools ###  libiconv  ###wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz;tar zxvf libiconv-1.14.tar.gz; cd libiconv-1.14/; ./configure --prefix=/usr/local; make && make install; cd ../;###  libcrypt  ###wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz;tar zxvf libmcrypt-2.5.7.tar.gz; cd libmcrypt-2.5.7/; ./configure; make && make install;cd libltdl/; ./configure --enable-ltdl-install; make && make install; cd ../../;###  mhash  ###wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gztar zxvf mhash-0.9.9.9.tar.gz; cd mhash-0.9.9.9/; ./configure; make && make install; cd ../;ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la; ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so; ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4; ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8; ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a; ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la; ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so; ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2; ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1; ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config;export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH###  mcrypt  ###wget http://pilotfiber.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz;tar zxvf mcrypt-2.6.8.tar.gz;cd mcrypt-2.6.8/;./configure; make && make install; cd ../;###  mysql  ###wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz;wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.11.tar.gz;useradd -M -s /sbin/nologin mysqltar -zxvf boost_1_59_0.tar.gz;tar -zxvf mysql-5.7.11.tar.gz;mkdir -p /data/mysql;cd mysql-5.7.11;cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/data/mysql \-DDOWNLOAD_BOOST=1 \   #从MySQL 5.7.5开始Boost库是必需的-DWITH_BOOST=../boost_1_59_0 \-DSYSCONFDIR=/etc \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DWITH_FEDERATED_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DENABLED_LOCAL_INFILE=1 \-DENABLE_DTRACE=0 \-DDEFAULT_CHARSET=utf8mb4 \-DDEFAULT_COLLATION=utf8mb4_general_ci \-DWITH_EMBEDDED_SERVER=1;make -j `grep processor /proc/cpuinfo | wc -l`  #编译很消耗系统资源,小内存可能编译通不过make install/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig --add mysqldchkconfig mysqld oncat > /etc/my.cnf << EOF[client]port = 3306socket = /tmp/mysql.sockdefault-character-set = utf8mb4[mysqld]port = 3306socket = /tmp/mysql.sockbasedir = /usr/local/mysqldatadir = /data/mysqlpid-file = /data/mysql/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1init-connect = 'SET NAMES utf8mb4'character-set-server = utf8mb4#skip-name-resolve#skip-networkingback_log = 300max_connections = 1000max_connect_errors = 6000open_files_limit = 65535table_open_cache = 128max_allowed_packet = 4Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8query_cache_type = 1query_cache_size = 8Mquery_cache_limit = 2Mft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedexpire_logs_days = 30log_error = /data/mysql/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = /data/mysql/mysql-slow.logperformance_schema = 0explicit_defaults_for_timestamp#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800[mysqldump]quickmax_allowed_packet = 16M[myisamchk]key_buffer_size = 8Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4MEOF### 初始化 ###/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql"--initialize"会生成一个随机密码(~/.mysql_secret),而"--initialize-insecure"不会生成密码--datadir目标目录下不能有数据文件/usr/local/mysql/bin/mysqladmin -uroot password "123";/etc/init.d/mysqld start;### php ###cp -frp /usr/lib64/libldap* /usr/lib/;  [Cannot find ldap libraries in /usr/lib]tar jxvf php-5.6.13.tar.bz2;cd php-5.6.13;./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-embed --enable-maintainer-zts --enable-debug --enable-opcache --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config;make ZEND_EXTRA_LIBS='-liconv' && make install;cp php.ini-development /usr/local/php/etc/php.ini;cp sapi/fpm/init.d.php-fpm /usr/local/php/sbin/chmod a+x /usr/local/php/sbin/init.d.php-fpmcp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confvim /usr/local/php/etc/php-fpm.confuser = nginxgroup = nginxuseradd -M -s /sbin/nologin nginx/usr/local/php/sbin/init.d.php-fpm startcd ../ ### pcre ###wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.bz2;tar -jxvf pcre-8.38.tar.bz2;cd pcre-8.38/;./configure;make && make install;cd ../;### nginx ###tar -zxvf nginx-1.9.12.tar.gz;   cd nginx-1.9.12/   ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module   make && make install   cd ../mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bakvim /usr/local/nginx/conf/nginx.confuser nginx nginx; worker_processes 2;#相当于cpu个数error_log logs/nginx_error.log;pid /usr/local/nginx/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 65535; events { use epoll; worker_connections 65535; } http { include mime.types; default_type application/octet-stream;#charset gb2312; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; keepalive_timeout 65; tcp_nodelay on; 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 128k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #limit_zone crawler $binary_remote_addr 10m;server { listen 80; server_name test.com; index index.html index.htm index.php; root /www; #limit_conn crawler 20; location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /nginxstatus{stub_status on;access_log off;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ {expires 1h; } } }/usr/local/nginx/sbin/nginx -tvim /etc/rc.local/usr/local/php/sbin/init.d.php-fpm start/usr/local/nginx/sbin/nginx/etc/init.d/mysqldvim /etc/profileulimit -SHn 65535export PATH=/usr/local/nginx/sbin:/usr/local/php/bin:$PATH平滑重启nginx进程1)Pkill -HUP nginx2)kill -HUP `pgrep -uroot nginx`3)/usr/local/nginx/sbin/nginx -s reload### PHP extension ### [https://pecl.php.net/package/包名]#  yaf  #wget https://pecl.php.net/get/yaf-2.3.3.tgz; [php7 => yaf 3.0]tar zxvf yaf-2.3.3.tgz;cd yaf-2.3.3;phpize;./configure --with-php-config=/usr/local/php/bin/php-configmake && make install;#  swoole  #wget https://pecl.php.net/get/swoole-1.8.2.tgz;tar zxvf swoole-1.8.2.tgz;cd swoole-1.8.2;phpize;./configure --with-php-config=/usr/local/php/bin/php-config --enable-async-mysql=/usr/local/mysql/ --enable-swoole-debug --enable-sockets --enable-openssl --enable-swoole;make && make install;# pdo-mysql #wget https://pecl.php.net/get/PDO_MYSQL-1.0.2.tgztar zxvf PDO_MYSQL-1.0.2.tgz;cd PDO_MYSQL-1.0.2;phpize;ln -s /usr/local/mysql/include/* /usr/local/include/./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysqlmake && make install;#  xdebug  #wget https://pecl.php.net/get/xdebug-2.4.0.tgz;tar zxvf xdebug-2.4.0.tgz;cd xdebug-2.4.0;phpize;./configure --with-php-config=/usr/local/php/bin/php-config --enable-xdebug;make && make install; [ https://xdebug.org/docs/ ][xdebug]xdebug.remote_enable         = Onxdebug.remote_host           = "localhost" [or ip]xdebug.remote_port           = 9000xdebug.remote_handler        = "dbgp"xdebug.auto_trace            = 1xdebug.collect_includes      = 1xdebug.collect_params        = 1xdebug.collect_return        = 1xdebug.default_enable        = 1xdebug.collect_assignments   = 1xdebug.collect_vars          = 1xdebug.remote_autostart      = 1xdebug.remote_connect_back   = 1xdebug.show_local_vars       = 1xdebug.show_exception_trace  = 0cd /php源码目录/php-5.6.13/ext/exif/phpize;./configure --with-php-config=/usr/local/php/bin/php-config --enable-exifmake && make install;cd /php源码目录/php-5.6.13/ext/mbstring/phpize;./configure --with-php-config=/usr/local/php/bin/php-config --enable-mbstringmake && make install;//编译之后不用修改php.ini#  memcached  #wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gztar zxvf libevent-2.0.22-stable.tar.gzcd libevent-2.0.22-stable ./configure --prefix=/usrmake && make installwget http://memcached.org/latesttar zxvf latestcd memcached-1.4.25/./configure --with-libevent=/usr --prefix=/usr/local/memcachedmake && make install启动Memcache的服务:  # /usr/local/bin/memcached -d -m 64  -u root -l 192.168.0.100 -p 11211 -c 1024 -P /tmp/memcached.pid -p memcached监听的TCP端口-l 监听ip地址,如果你需要多个服务器都能够读取这台memcached的缓存数据,那么就必须设定这个ip-d 以daemon方式运行,将程序放入后台-u memcached的运行用户-P memcached的pid文件路径-m memcached可以使用的最大内存数量-c memcached同时可以接受的最大的连接数如果你希望以socket方式来访问memcached,那么在启动的时候就必须去掉 -l和-p参数,并加上-s参数:-s memcached的socket文件路径wget https://pecl.php.net/get/memcache-3.0.8.tgz;tar zxvf memcache-3.0.8.tgz;cd memcache-3.0.8;phpize;./configure --with-php-config=/usr/local/php/bin/php-config;make && make install;# memcached #wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gztar zxvf libmemcached-1.0.18.tar.gz;cd libmemcached-1.0.18;./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached --with-mysql=/usr/local/mysql --with-gearmand=/usr/local/gearmandmake && make installwget https://pecl.php.net/get/memcached-2.2.0.tgztar zxvf memcached-2.2.0.tgz;cd memcached-2.2.0;phpize;./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcached --enable-memcached-json --enable-debug --with-libmemcached-dir=/usr/local/libmemcachedmake && make install;#  redis  #wget http://download.redis.io/redis-stable.tar.gz;tar zxvf redis-stable.tar.gz;  cd redis-stable;make;  cd src/;  make install;mkdir -p /usr/local/redis/{bin,data,etc,logs}cp redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server /usr/local/redis/bin/;  cd ../;cp redis.conf /usr/local/redis/etc//usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf  /usr/local/redis/bin/redis-cli -a yunduan -h 127.0.0.1 -p 6379 shutdown  /usr/local/redis/bin/redis-cli shutdown  pkill redis-server  killall redis-server wget https://pecl.php.net/get/redis-2.2.7.tgztar redis-2.2.7.tgzcd redis-2.2.7./configure --with-php-config=/usr/local/php/bin/php-config  make && make install#  mongodb  #https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.4.tgzmv mongodb-linux-x86_64-rhel62-3.2.3 /usr/local/mongodbmkdir -p /usr/local/mongodb/{data,dblogs}echo "/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data --fork --logpath=/usr/local/mongodb/dblogs/log">> /etc/rc.local# mongodb #wget https://pecl.php.net/get/mongodb-1.1.4.tgztar zxvf mongodb-1.1.4.tgz;cd mongodb-1.1.4;/usr/local/php/bin/phpize;./configure --with-php-config=/usr/local/php/bin/php-config;make&& make install;# mongo #wget https://pecl.php.net/get/mongo-1.6.13.tgz;#  xhprof  #wget https://pecl.php.net/get/xhprof-0.9.4.tgz;tar zxvf xhprof-0.9.4.tgz;cd xhprof-0.9.4/extension;/usr/local/php/bin/phpize;./configure --with-php-config=/usr/local/php/bin/php-config;make&& make install;1 下载 https://github.com/perftools/xhgui  (git clone https://github.com/perftools/xhgui.git)2 将cache目录改为777权限 chmod -R 0777 cache3 开启mongodb 如果mongodb需要密码登陆  则需要更改config/config.php4 安装 cd path/to/xhgui; php install.php 或者 composer update --prefer-dist --no-dev在composer.json添加一个国内镜像,    "repositories": {        "packagist": {            "type": "composer",            "url": "https://packagist.phpcomposer.com"        }    }5 开启rewrite 6 将header.php文件引入需要记录的虚拟机配置中三种方式 任选其一 添加到需要检测到网站:1. fastcgi_param PHP_VALUE "auto_prepend_file=/Users/markstory/Sites/xhgui/external/header.php";2. <?php  require '/path/to/xhgui/external/header.php'; 3. php -d auto_prepend_file=/path/to/xhgui/external/header.php do_work.phpxhgui配置一个可访问的虚拟机server  {      listen 80;      server_name    xhgui.test.com;      root   /home/yunduan/www/xhgui/webroot/;      index index.html index.php;        location / {          try_files $uri $uri/ /index.php?$query_string;      }      location ~ \.php$ {          fastcgi_pass    127.0.0.1:9000;          fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;          fastcgi_index index.php;          include fastcgi_params;      }  }  echo "127.0.0.1 xhgui.test.com" >> /etc/hosts; pkill -HUP nginx或者<?php<pre name="code" class="php">//统计开始xhprof_enable(XHPROF_FLAGS_CPU+XHPROF_FLAGS_MEMORY);/**  code  **///统计结束xhprof_end();function xhprof_end(){    $data = xhprof_disable();        $xhprof_root = "/usr/local/php/xhprof";    include_once $xhprof_root."/xhprof_lib/utils/xhprof_lib.php";    include_once $xhprof_root."/xhprof_lib/utils/xhprof_runs.php";        $xhprof_runs = new \XHprofRuns_Default();    $run_id = $xhprof_runs->save_run($data, "domain");//第二个参数在接下来的地方作为命名空间一样的概念来使用    setcookie("xhprof_url", "$run_id", $_SERVER['REQUEST_TIME'] + 3600, "/", "xx.com", false, true);//不影响正常的输出结果 将本次的run_id 写到cookie    //访问domain/index.php?run=$run_id&source=domain就能够看到一个统计列表了。}### Other install ###<= gearmand =>wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz;tar zxvf gearmand-1.1.12.tar.gz;cd gearmand-1.1.12;./configure --prefix=/usr/local/gearmand/;[yum -y install boost-devel*   configure: error: could not find boost-devel][yum -y install gperf*          configure: error: could not find gperf][yum -y install libevent-devel*   configure: error: could not find libevent-devel][yum -y install libuuid*        configure: error: Unable to find libuuid]make && make install;wget http://pecl.php.net/get/gearman-1.1.2.tgz;tar zxvf gearman-1.1.2.tgz;cd gearman-1.1.2;phpize;./configure --with-php-config=/usr/local/php/bin/php-config --with-gearman=/usr/local/gearmand/make && make install;rabbitMQ erlangwget http://erlang.org/download/otp_src_18.3.tar.gztar zxvf otp_src_18.3.tar.gz;cd otp_src_18.3;./configure --prefix=/usr/local/erlang;make && make install;ln -s /usr/local/erlang/bin/erl /usr/bin/erltar xvf rabbitmq-server-generic-unix-3.6.1.tar;mv rabbitmq_server-3.6.1/ /usr/local/rabbitMQ-3.6.1;chmod -R a+x /usr/local/rabbitMQ-3.6.1;./rabbitmq-server -detached;./rabbitmq-plugins enable rabbitmq_management;http://localhost:15672/ guest:guestphp extension安装librabbitmqwget https://github.com/alanxz/rabbitmq-c/releases/download/v0.7.1/rabbitmq-c-0.7.1.tar.gz  [https://github.com/alanxz/rabbitmq-c]tar zxvf rabbitmq-c-0.7.1.tar.gz;cd rabbitmq-c-0.7.1;./configure --prefix=/usr/local/rabbitmq-c-0.7.1;make && make install;wget https://pecl.php.net/get/amqp-1.7.0alpha2.tgz;cd amqp-1.7.0alpha2;phpize;./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.7.1;make && make install;http://php.net/manual/pl/amqp.examples.phpsvm install:wget mv libsvm.cgi\?+http\:%2F%2Fwww.csie.ntu.edu.tw%2F~cjlin%2Flibsvm+tar.gz  libsvm.tar.gztar zxvf libsvm.tar.gzcd libsvm-3.21/make libcp libsvm.so.2 /usr/lib/libsvm.socp libsvm.so.2 /usr/lib/wget https://pecl.php.net/get/svm-0.1.9.tgztar zxvf svm-0.1.9.tgzcd svm-0.1.9phpize./configure --with-php-config=/usr/local/php/bin/php-config;make && make install;<?php$data = array(    array(-1, 1 => 0.43, 3 => 0.12, 9284 => 0.2),    array(1, 1 => 0.22, 5 => 0.01, 94 => 0.11),);$svm = new SVM();$model = $svm->train($data);$data = array(1 => 0.43, 3 => 0.12, 9284 => 0.2);$result = $model->predict($data);var_dump($result);$model->save('model.svm');?>wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz;tar xzvf coreseek-4.1-beta.tar.gz;cd coreseek-4.1-beta;#安装mmsegcd mmseg-3.2.14;./bootstrap;./configure --prefix=/usr/local/mmseg3;make && make install;cd ../csft-4.1;#安装coreseeksh buildconf.sh;./configure --prefix=/usr/local/coreseek  --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql;make && make install; [sphinx.cpp:22292: undefined reference to `libiconv_open' -> vim src/Makefile == LIBS = -ldl -lm -lz -lexpat -liconv -L/usr/local/lib -lrt  -lpthread]cd ../testpack;#测试mmseg分词,coreseek搜索/usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc var/test/test.xml/usr/local/coreseek/bin/indexer -c etc/csft.conf --all/usr/local/coreseek/bin/search -c etc/csft.conf 网络搜索cd ../coreseek-4.1-beta/csft-4.1/api/libsphinxclient/;./configure  --prefix=/usr/local/sphinxclient --enable-debug;[config.status: error: cannot find input file: src/Makefile.in]{aclocal;libtoolize --force;automake --add-missing;autoconf;autoheader;make clean;}make && make install;[error while loading shared libraries: libiconv.so.2]{ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2ldconfig}wget https://pecl.php.net/get/sphinx-1.3.3.tgz;tar zxvf sphinx-1.3.3.tgz;cd sphinx-1.3.3phpize;./configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinxclientmake && make installend:amqp.so  gearman.so   memcached.so  mongodb.so  opcache.so    redis.so   svm.so     xdebug.so  yaf.soexif.so  memcache.so   mongo.so    pdo_mysql.so  sphinx.so  swoole.so  xhprof.soextension=memcache.soextension=memcached.soextension=mongodb.soextension=mongo.soextension=redis.soextension=xhprof.soextension=gearman.soextension=amqp.soextension=svm.soextension=pdo_mysql.soextension=sphinx.soextension=swoole.soextension=yaf.sozend_extension=opcache.so//必须在 Xdebug 扩展之前加载 OPcache 扩展zend_extension=xdebug.so[opcache]opcache.memory_consumption=128opcache.interned_strings_buffer=8opcache.max_accelerated_files=4000opcache.revalidate_freq=60opcache.fast_shutdown=1opcache.enable_cli=1ls -d */ | grep -v ^php | xargs rm -rf;#openresty  nginx lua 环境wget https://openresty.org/download/openresty-1.9.15.1.tar.gztar -xzvf openresty-1.9.15.1.tar.gz#安装LuaJITcd openresty-1.9.15.1/bundle/LuaJIT-2.1-20160517/make clean && make && make install#如果没有执行ln -sf luajit-2.1.0-beta2 /usr/local/bin/luajit 则手动执行一次#安装ngx_cache_purge模块,该模块用于清理nginx FastCGI, proxy, SCGI and uWSGI cachescd ../wget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.tar.gztar -xvf 2.3.tar.gz#安装nginx_upstream_check_module模块,该模块用于ustream健康检查wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz  tar -xvf v0.3.0.tar.gz #安装ngx_openrestycd .././configure --user=nginx --group=nginx --prefix=/usr/local/servers --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module  --with-pcre  --with-luajit --add-module=./bundle/ngx_cache_purge-2.3/ --add-module=./bundle/nginx_upstream_check_module-0.3.0/ gmake && gmake install/usr/local/serversvim /usr/local/servers/nginx/conf/nginx.confhttp部分添加{<span style="white-space:pre"></span>#lua模块路径,多个之间”;”分隔,其中”;;”表示默认搜索路径,默认到/usr/local/servers/nginx下找  <span style="white-space:pre"></span>lua_package_path "/usr/local/servers/nginx/lualib/?.lua;;";  #lua 模块<span style="white-space:pre"></span>lua_package_cpath "/usr/local/servers/nginx/lualib/?.so;;";  #c模块<span style="white-space:pre"></span>include lua.conf;}lua.conf文件为测试lua开发,包含[<span style="white-space:pre"></span>server {  <span style="white-space:pre"></span>    listen       80;<span style="white-space:pre"></span>    server_name  _;<span style="white-space:pre"></span>    location /lua {  <span style="white-space:pre"></span>    default_type 'text/html';<span style="white-space:pre"></span>    lua_code_cache off;#关闭缓存,这样调试时每次修改lua代码不需要reload nginx;但是正式环境一定记得开启缓存。 <span style="white-space:pre"></span>    #content_by_lua 'ngx.say("hello ")';  <span style="white-space:pre"></span>   <span style="white-space:pre"></span>content_by_lua_file conf/lua/test.lua; #相对于nginx安装目录<span style="white-space:pre"></span>}<span style="white-space:pre"></span>}]vim /usr/local/servers/nginx/conf/lua/test.lua[<span style="white-space:pre"></span>ngx.say("world");]/usr/local/servers/nginx/sbin/nginx -t/usr/local/servers/nginx/sbin/nginx -s reloadcurl http://luat.com/luaworldnginx+lua项目构建目录结构example    example.conf     ---该项目的nginx 配置文件    lua              ---我们自己的lua代码      test.lua    lualib            ---lua依赖库/第三方依赖      *.lua      *.so

0 0
原创粉丝点击