邢栋博客

邢栋博客,Action博客,记录工作和生活中的点点滴滴

windows下apache支持php-nts版本

帮同学的windows服务装个禅道,登录进去才发现只有apache,没有php,也没有mysql

装完php和mysql,发现访问php文件直接展示没有解析,于是就开始配置apache解析php的模块

好多年windows+apache这种组合了,搞了半天才解决

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>
        FcgidInitialEnv PHPRC "F:/Web/PHPServer/Bin/PHP"
        FcgidInitialEnv PHP_FCGI_MAX_REQUESTS      1000
        FcgidMaxRequestsPerProcess       1000
        FcgidMaxProcesses             15
        FcgidIOTimeout             120
        FcgidIdleTimeout                120
        AddType application/x-httpd-php .php
        <Files ~ "\.php$>"
          AddHandler fcgid-script .php
          FcgidWrapper "F:/Web/PHPServer/Bin/PHP/php-cgi.exe" .php
        </Files>
</IfModule>

<Directory "F:/Web/www">
        AllowOverride All
        Options -Indexes +ExecCGI
</Directory>


centos7 执行启动邮件服务报错-systemctl start postfix


错误信息如下

Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.


解决办法

修改 /etc/postfix/main.cf的设置

inet_protocols = ipv4
inet_interfaces = all
最完美 ThinkPHP(tp) 的 Nginx 配置文件

===系统===
LSB Version:    :....(太长了)
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:        8.2.2004
Codename:       Core


===使用官网给的没有生效===

location / { // …..省略部分代码
   if (!-e $request_filename) {
    rewrite  ^(.*)$  /index.php?s=/$1  last;
    }
}

===于是===

server {
    listen       80;
    server_name  mydomain.com;
    access_log /data/logs/access_nginx.log combined;
    root /data/www/test_sdk/public;
    index  index.html index.htm index.php;    
    location / {
        try_files $uri @rewrite;
    }
    
    location /nginx_status {
      stub_status on;
      access_log off;
      allow 127.0.0.1;
      deny all;
    }

    location @rewrite {
        set $static 0;
        if  ($uri ~ \.(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css\.map|min\.map)$) {
            set $static 1;
        }
        if ($static = 0) {
            rewrite ^/index.php(.*)$ /index.php?s=/$1 last;
        }
    }
    location ~ \.php/ {
       if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { }
       #fastcgi_pass remote_php_ip:9000;
       fastcgi_pass unix:/dev/shm/php-cgi.sock;
       include fastcgi_params;
       fastcgi_param SCRIPT_NAME     $1;
       fastcgi_param PATH_INFO       $2;
       fastcgi_param SCRIPT_FILENAME $document_root$1;
    }
    location ~ \.php$ {
        #fastcgi_pass remote_php_ip:9000;
        fastcgi_pass unix:/dev/shm/php-cgi.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
      expires 30d;
      access_log off;
    }
    location ~ .*\.(js|css)?$ {
      expires 7d;
      access_log off;
    }
    location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
      deny all;
    }
}



===参考链接===

https://www.kancloud.cn/manual/thinkphp6_0/1037488

https://www.seasidecrab.com/tp/487.html

http://www.thinkphp.cn/topic/34380.html


centos下openresty+lua入门实践
===安装openresty===

1、安装依赖开发库
yum install pcre-devel openssl-devel gcc curl postgresql-devel

2、下载 + 编译 + 安装


我刚开始先下载的1.19.3.1版本,但是在编译时增加nginx_upstream_check_module模块,一直报错,错误信息如下
./configure: error: the ngx_http_upstream_check_module addon error. 按照 https://github.com/yaoweibin/nginx_upstream_check_module这里的步骤执行还是失败,于是就更换了低版本 1.15.8.2

==下载openresty+解压==
cd ~
wget https://openresty.org/download/openresty-1.15.8.2.tar.gz
tar -zxvf openresty-1.15.8.2.tar.gz

==下载nginx_upstream_check_module模块==
git clone https://github.com/yaoweibin/nginx_upstream_check_module.git
cp -R nginx_upstream_check_module ~/openresty-1.15.8.2/bundle/

==下载ngx_cache_purge模块==
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
cp -R ngx_cache_purge ~/openresty-1.15.8.2/bundle/

==准备工作完成开始编译==
cd openresty-1.15.8.2
./configure --prefix=/opt/openresty \
      --with-pcre  \
      --with-luajit \
      --with-http_realip_module  \
      --with-http_iconv_module \
      --with-http_postgres_module \
      --add-module=./bundle/ngx_cache_purge \
      --add-module=./bundle/nginx_upstream_check_module
make && make install

--with*** 安装一些内置/集成的模块
--with-http_realip_module 取用户真实 ip 模块
-with-pcre Perl 兼容的达式模块
--with-luajit 集成 luajit 模块
--add-module 添加自定义的第三方模块,ngx_cache_purge用于清除指定url的缓存 nginx_upstream_check_module健康检查


3、配置lua环境

3.1 编辑 nginx.conf

vim /opt/openresty/nginx/conf/nginx.conf
在http部分加入以下代码
#lua模块路径,多个之间”;”分隔,其中”;;”表示默认搜索路径,默认到/opt/openresty/下找
lua_package_path "/opt/openresty/lualib/?.lua;;";  #lua 模块
lua_package_cpath "/opt/openresty/lualib/?.so;;";  #c模块
include lua.conf;#引入lua.conf
3.2 编辑lua.conf

vim lua.conf 写入以下代码
server {
    listen       8080;
    server_name  _;

    location /lua {
    default_type 'text/html';
        content_by_lua 'ngx.say("hello world")';
    }

   location /filelua {
        default_type 'text/html';
        lua_code_cache off;#关闭缓存,这样调试时每次修改lua代码不需要reload nginx
        content_by_lua_file conf/lua/test.lua;
   }
}


mkdir lua
cd lua
vim test.lua #写入以下代码
ngx.say("hello world,lua file");

然后重启nginx
/opt/openresty/nginx/sbin -t

/opt/openresty/nginx/sbin -c  /opt/openresty/nginx/conf/nginx.conf
或者
/opt/openresty/nginx/sbin -s reload


3.3 测试

curl 127.0.0.1:8080/lua   ##  hello world
curl 127.0.0.1:8080/filelua  ## hello world,lua file 
docker安装es的中文分词器ik插件


es-ik.png

===两种安装方式===

1、use elasticsearch-plugin to install

docker exec -it elasticsearch /bin/sh
cd bin/
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip

#执行完毕后 
elasticsearch-plugin list #查看
elasticsearch-plugin remove analysis-ik #删除


2、download 插件
docker exec -it elasticsearch /bin/sh
cd plugins && mkdir ik
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
unzip elasticsearch-analysis-ik-7.1.1.zip


======安装完成后重启服务======


====增加分词====

docker exec -it elasticsearch /bin/sh
cd config/analysis-ik/
echo '济南彭于晏' >> main.dic

======安装完成后重启服务======



=====参考链接=====
https://github.com/medcl/elasticsearch-analysis-ik
https://github.com/yeszao/dnmp



Mac下使用clion调试redis源码

1、先从github上下载源码
1)搜索 https://github.com/search?q=redis+clion
2)最好是选择别人配置好CMakeLists.txt的,不然自己配置也很麻烦


2、下载完成,开始配置
//选择一个想要调试的版本进行下载
wget https://github.com/htw0056/redis-3.0-annotated-cmake-in-clion/archive/master.zip
//解压
unzip redis-3.0-annotated-cmake-in-clion-master.zip
//重命名+拷贝
mv redis-3.0-annotated-cmake-in-clion-master redis-3.0
cp -R redis-3.0 redis-3.0-make

//编译
cd redis-3.0-make/src
make


3、打开clion软件,导入redis-3.0项目
1)搜索到saddCommand命令,打个断点,开启debug模式

image2020-12-9_20-56-1.png
4、进入到客户端服务器,执行sadd命令
1)进入到redis-3.0-make/src,开始执行命令
./redis-cli
sadd numbers 1 77777 xd
这个时候就打开clion软件一步一步往下走了

image2020-12-9_20-57-44.png

Mac下安装gdb证书
1、先按照csdn上面的这边文章进行添加证书,名称设为 code_gdbsign
https://blog.csdn.net/LU_ZHAO/article/details/104803399/

2、假如你的mac系统大于Mac OS X 10.14,则

vim gdb-entitlement.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.cs.debugger</key>
    <true/>
    <key>com.apple.security.get-task-allow</key>
    <true/>
</dict>
</plist>
</pre>

然后执行
codesign --entitlements gdb-entitlement.xml -fs code_gdbsign $(which gdb)

3、如果mac系统早于10.14,则执行以下命令即可


codesign -fs code_gdbsign $(which gdb)




Mac系统实现git命令补全
1、先安装brew,安装过的可以忽略
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2、安装bash-completion
brew install bash-completion

3、系统配置

下载此文件
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
然后复制到家目录
cp xxx/git-completion.bash ~/.git-completion.bash

vim ~/.bash_profile 加入以下代码
if [ -f ~/.git-completion.bash ]; then
   . ~/.git-completion.bash
fi

读取文件
source ~/.git-completion.bash


最新微语