Aliyun用nginx配置https

首先在阿里云购买域名,申请域名证书,可以免费申请一年 nginx配置https过程 https://yq.aliyun.com/articles/672835 示例 server { listen 444 ssl; server_name zhangxiaofeng.top localhost; # ssl证书地址 ssl_certificate /etc/nginx/cert/4879361_zhangxiaofeng.top.pem; # pem文件的路径 ssl_certificate_key /etc/nginx/cert/4879361_zhangxiaofeng.top.key; # key文件的路径 # ssl验证相关配置 ssl_session_timeout 5m; #缓存有效期 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #加密算法 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #安全链接可选的加密协议 ssl_prefer_server_ciphers on; #使用服务器端的首选算法 #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } 访问: https://zhangxiaofeng.top:444 ...

January 10, 2021 · 1 min · zhangxiaofeng05

deepin编译安装Python3.6

官网下载源码 官网:https://www.python.org/downloads/source/ cd /opt/python/ sudo wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tar.xz sudo xz -d Python-3.6.10.tar.xz sudo tar xvf Python-3.6.10.tar cd Python-3.6.10/ sudo ./configure --prefix=/usr/local/python3.6 sudo make sudo make install sudo ln -s /usr/local/python3.6/bin/python3 /usr/bin/python3.6 虚拟环境 python3.6 -m venv ./env #创建虚拟环境 source env/bin/activate #激活虚拟环境 python官方文档 https://docs.python.org/zh-cn/3/library/venv.html

January 18, 2020 · 1 min · zhangxiaofeng05

deepin安装使用Oh My Zsh

安装Oh My Zsh github地址:https://github.com/ohmyzsh/ohmyzsh sudo apt install zsh sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # 将 Zsh 设置为默认 Shell chsh -s /bin/zsh # 查看当前所用的 Shell echo $SHELL # 查看系统内已安装的 Shell cat /etc/shells ps:root执行此脚本只能root使用Oh My Zsh,其他用户使用需要在那个用户下执行此安装脚本 更换主题 vi ~/.zshrc #ZSH_THEME="robbyrussell" ZSH_THEME="agnoster" #ZSH_THEME="amuse" #ZSH_THEME="fishy" #ZSH_THEME="ys" source ~/.zshrc agnoster主题箭头无法正常显示 检查是否安装PowerlineSymbols字体 如果没有安装,官方安装文档https://powerline.readthedocs.io/en/latest/installation.html 在终端选择能够正常显示箭头的字体 PowerlineSymbols,DejaVu Sans Mono 安装字体参考: https://github.com/powerline/fonts 比如: sudo apt-get install fonts-powerline,以GitHub为准。 deepin 15.11为例,系统已经装好字体了,但是没有正常显示箭头,在终端尝试哪个字体能够正常显示.

January 10, 2020 · 1 min · zhangxiaofeng05

命令行下测试服务器外网速度speedtest-cli

speedtest-cli命令 speedtest-cli是一个使用python编写的命令行脚本,通过调用speedtest.net测试上下行的接口来完成速度测试 linux命令大全:https://man.linuxde.net/speedtest-cli github地址:https://github.com/sivel/speedtest-cli 使用方式 自己看作者的README.md 此处列一个简单的方法 wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py chmod +x speedtest-cli 命令 ./speedtest-cli -h 打印帮助信息 ./speedtest-cli --share 测速

January 7, 2020 · 1 min · zhangxiaofeng05

Lrzsz用于小文件的上传下载

百度百科 lrzsz是一款在linux里可代替ftp上传和下载的程序。 使用方法 centos服务器,可直接yum -y install lrzsz 程序会自动安装好,然后如你要下载则sz [找到你要下载的文件] 如果你要上传,则rz 浏览找到你本机要上传的文件。需要注意的事这个命令无法在putty界面使用哦! 注意 deepin-terminal:使用命令出现乱码,需要用鼠标右击终端然后点击上传文件、下载文件。

January 7, 2020 · 1 min · zhangxiaofeng05

linux安装并配置nginx

维基百科 Nginx是异步框架的网页服务器,也可以用作反向代理、负载平衡器和HTTP缓存。 安装 官网:https://www.nginx.com/ 官网安装文档:http://nginx.org/en/docs/install.html 安装完成:http://127.0.0.1/ 管理命令 systemctl restart nginx.service 重启 systemctl status nginx.service 查看运行状态 systemctl start nginx.service 启动 systemctl stop nginx.service 关闭 systemctl enable nginx.service 开机自启 systemctl disable nginx.service 关闭开机自启 默认配置文件 以CentOS/7.3.1611、 nginx/1.12.2为例: 默认配置:/etc/nginx/nginx.conf # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ #user nginx; user root; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-streamo; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; autoindex on; autoindex_exact_size off; autoindex_localtime on; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } # Settings for a TLS enabled server. # # server { # listen 443 ssl http2 default_server; # listen [::]:443 ssl http2 default_server; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /40x.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # } } 自己新加的conf可以放在cd /etc/nginx/conf.d目录下 ...

January 5, 2020 · 2 min · zhangxiaofeng05

linux使用v2ray作为客户端

安装v2ray 官网:https://www.v2ray.com/ (被墙,如果可以,不明白的多看官网) github地址:https://github.com/v2ray/v2ray-core 在root用户环境下运行 yum 或 apt-get 安装v2ray 或者执行安装脚本bash <(curl -L -s https://install.direct/go.sh) 此脚本会自动安装以下文件: /usr/bin/v2ray/v2ray:V2Ray 程序; /usr/bin/v2ray/v2ctl:V2Ray 工具; /etc/v2ray/config.json:配置文件; /usr/bin/v2ray/geoip.dat:IP 数据文件 /usr/bin/v2ray/geosite.dat:域名数据文件 此脚本会配置自动运行脚本。自动运行脚本会在系统重启之后,自动运行 V2Ray。 脚本运行完成后,你需要: 编辑 /etc/v2ray/config.json 文件来配置你需要的代理方式; config.json { "inbound": { "port": 1080, "protocol": "socks", "domainOverride": ["tls","http"], "settings": { "auth": "noauth" } }, "outbound": { "protocol": "vmess", "settings": { "vnext": [ { "address": "216.244.76.219", "port": 54321, "users": [ { "id": "3cf35a68-ea46-11e9-9cab-003048d37a3c", "alterId": 64, "security": "aes-128-gcm" } ] } ] }, "streamSettings": { "network": "tcp", "security": "aes-128-gcm" } } } 运行 service v2ray start 来启动 V2Ray 进程; 之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。 或者使用 systemctl status v2ray.service systemctl start v2ray.service systemctl stop v2ray.service systemctl restart v2ray.service 图形客户端(推荐:支持订阅) Windows v2rayN(第三方): https://github.com/2dust/v2rayN/releases/latest 下载v2rayN-Core.zip Linux Qv2ray(第三方): https://github.com/lhy0403/Qv2ray/releases 下载Qv2ray.v2.4.1.linux-x64.AppImage,添加权限chmod 755 Qv2ray.v2.4.1.linux-x64.AppImage,双击便可执行 具体配置参考文章:https://linger.ink/2020/linux-qv2ray-usage Mac v2rayX(第三方): https://github.com/insisttech/v2rayX-copy/releases v2rayU(第三方): https://github.com/yanue/V2rayU/releases ps:由于是第三方依赖v2ray,需要指定下载的v2ray的路径,v2ray:https://github.com/v2ray/v2ray-core/releases ,下载v2ray-linux-64.zip ...

January 4, 2020 · 1 min · zhangxiaofeng05

vim安装插件

注意:推荐参考:https://github.com/zhangxiaofeng05/dotfiles 插件管理器(Vundle.vim) 安装 github地址:https://github.com/VundleVim/Vundle.vim (仔细看README.md) clone git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 修改配置文件 vim ~/.vimrc set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' "plugin------------------------" “Plugin '插件名' "看作者的README.md,有示例 "plugin------------------------" " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line Install Plugins Launch vim and run :PluginInstall To install from command line: vim +PluginInstall +qall 安装NERDTree 安装此插件需要安装插件管理器 github地址:https://github.com/preservim/nerdtree (仔细看README.md) ...

January 2, 2020 · 3 min · zhangxiaofeng05

Docker

维基百科 https://zh.wikipedia.org/wiki/Docker Docker是一个开放源代码软件项目,让应用程序部署在软件货柜下的工作可以自动化进行,借此在Linux操作系统上,提供一个额外的软件抽象层,以及操作系统层虚拟化的自动管理机制。 docker官网 官网:https://www.docker.com/ 官网安装指南:https://docs.docker.com/install/ docker安装软件比较简单,很适合学习,避免了linux的各种版本安装软件的繁琐。 Docker Hub https://hub.docker.com/ Docker Hub是一个由Docker公司负责维护的公共注册中心,它包含了超过15,000个可用来下载和构建容器的镜像,并且还提供认证、工作组结构、工作流工具(比如webhooks)、构建触发器以及私有工具(比如私有仓库可用于存储你并不想公开分享的镜像)。 举例:docker安装MySQL 官网安装指南:https://hub.docker.com/_/mysql 举例: docker pull mysql:5.7.28 docker run -p 3306:3306 --name mysql5.7 -e MYSQL_ROOT_PASSWORD=password -d mysql:5.7.28 具参数查看官网!!! 举例:docker安装phpmyadmin 官网安装指南:https://hub.docker.com/r/phpmyadmin/phpmyadmin 举例: docker pull phpmyadmin/phpmyadmin docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 6060:80 phpmyadmin/phpmyadmin 此命令安装,登录任意服务器地址端口,空格为分割 pull代理 使用docker pull命令,下载镜像慢,设置代理 mac Dashboard -> Settings -> Resources -> Proxies 即可使用http代理 Web Server(HTTP) http://127.0.0.1:1081 Secure Web Server(HTTPS) http://127.0.0.1:1081

December 8, 2019 · 1 min · zhangxiaofeng05

解决vim粘贴错乱问题

vim打开文件后 1、在视图模式下输入 :set paste 2、按i进入编辑模式 3、粘贴((win)Ctrl+v | Shift+Insert(linux)) 4、关闭粘贴 :set nopaste

November 28, 2019 · 1 min · zhangxiaofeng05