2018-11-16 14:02:45   Visit  8338

使用nginx -V,查看当前nginx的信息,包括版本号和configure编译配置信息

版本号 1.14.1
configure

--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\\\'

下载相同版本号的源码

http://nginx.org/en/download.html

解压,cd到源码目录

下载解压要编译的模块源码和nginx源码目录同一目录
在nginx源码目录下执行configure
configure参数包括已安装的参数和你要添加的模块
例如

./configure --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\\\' --add-module=../nginx-rtmp-module-1.2.1

--add-module=../nginx-rtmp-module-1.2.1 就是我要添加的模块

configure完成后执行make编译
记住不要install
编译后的nginx在当前目录的objs文件夹内。
备份 /usr/sbin 目录下的nginx文件
把编译后的objs文件夹内的nginx问价移动到、usr/sbin 文件夹内

重启nginx
nginx -s stop
nginx

运行nginx -V发现已经包含需要的模块了

2018-11-16 12:07:37   Visit  5006

下载php源码

解压

configure

./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir

遇到没有的组件使用yum安装

make all install

启动php

php-fpm

关闭php

pkill php-fpm

nginx配置

#当请求网站下php文件的时候,反向代理到php-fpm
        location ~ \\.php$ {
            include /etc/nginx/fastcgi.conf; #加载nginx的fastcgi模块
            fastcgi_intercept_errors on;
            fastcgi_pass   127.0.0.1:9000; #nginx fastcgi进程监听的IP地址和端口
        }

/fastcgi.conf 文件


fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

2018-11-16 11:39:40   Visit  4138
nginx: [emerg] module \"/usr/lib64/nginx/modules/ngx_http_geoip_module.so\" version 1012002 instead of 1014000 in /usr/share/nginx/modules/mod-http-geoip.conf:1

是老版本的NGINX模块不适合新版本的NGINX导致的,需要卸载老版本的模块然后再安装新版本的模块

yum remove nginx-mod*

yum install nginx-module-*
2018-11-09 09:43:03   Visit  3284

简单服务

var http = require(\'http\');

http.createServer(function (request, response) {

    // 发送 HTTP 头部 
    // HTTP 状态值: 200 : OK
    // 内容类型: text/plain
    response.writeHead(200, {\'Content-Type\': \'text/plain\'});

    // 发送响应数据 \"Hello World\"
    response.end(\'Hello World\\n\');
}).listen(8888);

// 终端打印如下信息
console.log(\'Server running at http://127.0.0.1:8888/\');

http静态文件服务

安装http-server

npm install http-server -g

启动服务

http-server -p 8089
2018-11-07 11:29:52   Visit  3534

添加postgresql官网安装源

在/etc/yum.repos.d目录下新建pgdg-10-centos.repo 文件

[pgdg10]
name=PostgreSQL 10 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

[pgdg10-source]
name=PostgreSQL 10 $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

[pgdg10-updates-testing]
name=PostgreSQL 10 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/testing/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

[pgdg10-source-updates-testing]
name=PostgreSQL 10 $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

更新yum

yum update

安装

yum install postgresql10-contrib postgresql10-server -y

初始化数据库

/usr/pgsql-10/bin/postgresql-10-setup initdb

创建服务链接

sudo systemctl start postgresql-10
sudo systemctl enable postgresql-10.service

切换到postgresql用户

su postgres
2018-11-07 10:34:14   Visit  2425
route add 10.0.0.0 mask 255.0.0.0 172.16.1.253 -p
2018-11-05 11:04:46   Visit  1783

版本

git add filename  //添加文件至暂存区
git commit -m “commit  description” // 提交暂存区至版本(只提交暂存区的内容,工作区修改未提交至暂存区的不提交至版本)
git status   查看状态
git diff 比对

文件管理

git add test.txt
git rm test.txt
git checkout -- test.txt   //恢复在文件系统中误删的文件,恢复在工作区中修改的文件

git reset HEAD readme.txt  //撤销暂存区的修改(工作区中仍然是修改状态,如果想恢复原来文件,使用checkout恢复文件至上一个版本)

关联远程


git remote add origin git@server-name:path/repo-name.git

git remote -v  显示远程服务信息
git remote rm origin  删除远程关联

提交至远程

git push -u origin master  --第一次推送master分支的所有内容
git push origin master  --推送最新修改

clone

$ git clone git@github.com:michaelliao/gitskills.git

分支

查看分支:git branch

创建分支:git branch <name>

切换分支:git checkout <name>

创建+切换分支:git checkout -b <name>
从远程获取分支: git checkout -b dev origin/dev

合并某分支到当前分支:git merge <name>

删除分支:git branch -d <name>
删除未合并过的分支:git branch -D <name>

关联本地分支和远程分支 :  git branch --set-upstream-to=github/dev dev

储藏

git status  保存现在的工作空间
git stash list 
git stash apply 恢复指定储藏
git stash drop 删除指定储藏 默认最后一个
git stash pop 恢复并删除最后一个储藏

日志

图形化显示日志
git log --graph --pretty=oneline --abbrev-commit

git config --global alias.lg \\\\\\\"log --color --graph --pretty=format:\\\\\\\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\\\\\\\' --abbrev-commit\\\\\\\"

标签

git tag v1.0  打标签
git tag v0.9 f52c633    根据给定的提交版本打标签
git tag -a v0.1 -m  \\\"version 0.1 released \\\" 1094adb  根据给定的提交版本打标签  并添加说明
git tag  查看标签列表
git show v0.1  查看标签详情

git tag -d v0.1  删除标签
git push GitHub :refs/tags/v0.1 删除远程标签

git push GitHub v1.0  推送指定标签到远程
git push GitHub --tags 推送所有标签到远程

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

2018-11-02 11:23:09   Visit  1863

在/etc/yum.repos.d 目录下创建文件gitlab-ce.repo,使用国内的安装源

baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

清理yum缓存

yum makecache

安装

yum install gitlab-ce

gitlab-ce 在centos中的目录

配置目录在这里
/etc/gitlab
主目录在这里
/opt/gitlab
运行目录在这里

gitlab-ctl reconfigure 后生成的新的配置文件都在这里

/var/opt/gitlab

启动

gitlab-ctl start

修改配置

配置文件是 /etc/gitlab 下的gitlab.rb

修改域名

external_url \\\'https://gitlab.leechg.com\\\'

配置nignx端口

gitlab内置NGINX,修改其配置也要在gitlab.rb文件中进行

nginx[\\\'listen_port\\\'] = 8100

gitlab服务端口修改

# unicorn[\\\'backlog_socket\\\'] = 1024

修改完配置后一定要运行 gitlab-ctl reconfigure 才能生效

gitlab-ctl reconfigure 
2018-10-29 16:57:07   Visit  1942

安装python的docx支持

python -m pip install  python-docx
# -*- coding: utf-8 -*-
import docx
from docx import Document
 

path = \"./file2.docx\"
document = Document(path)
 
def readlist():
    table_count = 0
    row_count = 0
    textlist = []
    for paragraph in document.paragraphs:
        
        r_text = paragraph.text
        textlist.append(r_text)
     
        row_count = row_count+1
        if r_text.startswith(u\'表名\'):
            # print row_count
            
            tablenamec =  textlist[row_count-2]
            tablenamearr = textlist[row_count-1].split(u\':\')
            tablename  = tablenamearr[len(tablenamearr)-1]
            print tablenamec,tablename
            readtable(table_count)
            textlist = []
            row_count=0
            table_count =table_count+1

def readtable(table_count): 
    # 遍历所有表格
    tables = document.tables
    table = tables[table_count]
    rowlen = len(table.rows)
    if rowlen>1:
        collen = len(table.rows[0].cells)
        row_num = 0
        for row in table.rows:
            if(row_num>0):
                colname = row.cells[1].text
                colnamec = row.cells[2].text
                bz = \"\"
                if(collen>4):
                    bz =  row.cells[4].text
                else:
                    bz =  row.cells[3].text
                sql = u\"insert into tablename (a,b,c,d) values(\'{0}\',\'{1}\',\'{2}\',\'{3}\')\".format(row_num,colname,colnamec ,bz)
                # print sql
            row_num = row_num +1
    # 
    # for table in document.tables:
    #     for row in table.rows:
    #         print row.cells[2].text

if __name__ ==\"__main__\":
    print \"start\"
    readlist()

2018-10-26 11:41:50   Visit  4579
function js_getDPI() {
 var arrDPI = new Array();
 if (window.screen.deviceXDPI != undefined) {
? arrDPI[0] = window.screen.deviceXDPI;
? arrDPI[1] = window.screen.deviceYDPI;
 }
 else {
? var tmpNode = document.createElement(\"DIV\");
? tmpNode.style.cssText = \"width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden\";
? document.body.appendChild(tmpNode);
? arrDPI[0] = parseInt(tmpNode.offsetWidth);
? arrDPI[1] = parseInt(tmpNode.offsetHeight);
? tmpNode.parentNode.removeChild(tmpNode); 
 }
 return arrDPI;
}