autoconf

% phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.



% brew install autoconf



configure:4303: error: possibly undefined macro: AC_CHECK_HEADERS
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.



% brew install pkg-config



% brew reinstall pkg-config



% autoconf



./configure



https://github.com/sanger-pathogens/gubbins/issues/130



autoreconf -i



glibtoolize: You should add the contents of the following files to ‘aclocal.m4’:
glibtoolize: ‘/usr/local/Cellar/libtool/2.4.6_2/share/aclocal/libtool.m4’
glibtoolize: ‘/usr/local/Cellar/libtool/2.4.6_2/share/aclocal/ltoptions.m4’
glibtoolize: ‘/usr/local/Cellar/libtool/2.4.6_2/share/aclocal/ltsugar.m4’
glibtoolize: ‘/usr/local/Cellar/libtool/2.4.6_2/share/aclocal/ltversion.m4’
glibtoolize: ‘/usr/local/Cellar/libtool/2.4.6_2/share/aclocal/lt~obsolete.m4’
glibtoolize: Consider adding ‘AC_CONFIG_MACRO_DIRS([m4])’ to configure.ac,
glibtoolize: and rerunning glibtoolize and aclocal.
glibtoolize: Consider adding ‘-I m4’ to ACLOCAL_AMFLAGS in Makefile.am.



% autoconf



% autoreconf –install
glibtoolize: putting auxiliary files in ‘.’.
glibtoolize: copying file ‘./ltmain.sh’
glibtoolize: Consider adding ‘AC_CONFIG_MACRO_DIRS([m4])’ to configure.ac,
glibtoolize: and rerunning glibtoolize and aclocal.
glibtoolize: Consider adding ‘-I m4’ to ACLOCAL_AMFLAGS in Makefile.am.



openresty -p /Users/didi/www/ -c conf/nginx.conf



% sudo openresty -s reload
Password:
nginx: [alert] kill(45640, 1) failed (3: No such process)



https://github.com/openresty/openresty/issues/476



% sudo /opt/openresty/nginx/sbin/nginx -s reload
Password:
nginx: [alert] kill(45640, 1) failed (3: No such process)



% /opt/openresty/nginx/sbin/nginx -t
\nginx: the configuration file /opt/openresty/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] open() “/opt/openresty/nginx/logs/nginx.pid” failed (13: Permission denied)
nginx: configuration file /opt/openresty/nginx/conf/nginx.conf test failed



sudo chmod 777 /opt/openresty/nginx/logs/nginx.pid



sudo chmod 777 /opt/openresty/nginx/logs/access.log



% cat /opt/openresty/nginx/logs/nginx.pid
45640



% sudo chmod 777 /opt/openresty/nginx/logs/



原因找不到nginx的pid文件
vi conf/nginx.conf
#进程pid文件
pid /opt/openresty/nginx/logs/nginx.pid;



% openresty -p /Users/didi/www/ -c conf/nginx.conf
nginx: [emerg] unknown directive “/opt/openresty/nginx/logs/nginx.pid” in /Users/didi/www/conf/nginx.conf:3



https://blog.csdn.net/daiyu__zz/article/details/81782453



https://www.cnblogs.com/digdeep/p/4859575.html



% openresty -s reload
问题解决了





  1. 最简单的helloworld
    location /hello1 {
    echo “hello 1111!”;
    }




  2. 异步请求其他echo请求
    location /hello2 {
    echo “hello 2222!”;
    echo_location_async /hello1;
    }




  3. 输出GET请求参数,假设参数名是name,这里并对name参数进行解码
    location /hello3 {
    set_unescape_uri $name $arg_name;
    set_if_empty $name “None”;
    echo “hello, $name!”;
    }





location /memcached {
set $memc_cmd $arg_cmd;
set $memc_key $arg_key;
set $memc_value $arg_val;
set $memc_exptime $arg_exptime;
memc_pass 127.0.0.1:11211;
}



添加MySQL配置


upstream mysql {
drizzle_server 127.0.0.1:3306 dbname=test user=smallfish password=123 protocol=mysql;
}



通过url匹配出name,并编码防止注入,最后以json格式输出结果。


location ~ ‘^/mysql/(.*)’ {
set $name $1;
set_quote_sql_str $quote_name $name;
set $sql “SELECT * FROM users WHERE name=$quote_name”;
drizzle_query $sql;
drizzle_pass mysql;
rds_json on;
}



查看MySQL服务状态,这个很实用哦。


location /mysql-status {
drizzle_status;
}



location /lua1 {
default_type ‘text/plain’;
content_by_lua ‘ngx.say(“hello, lua”)’;
}



请求另外的url


location /lua2 {
content_by_lua ‘
local res = ngx.location.capture(“/hello1”)
ngx.say(“data: “ .. res.body)
‘;
}



Lua支持的选项很多,具体可参考官网WIKI文档。



https://www.codenong.com/cs105879032/
https://github.com/umlaeute/Gem/issues/141



Category php