Archive 归档

loading ..

loading ..

## (一)Nginx 要求 ### 1)最新版本支持查询
nginx -v 2>&1 | awk -F ' |/' '{print $4}' | grep -E '1.18.0' && echo '* 版本符合' || echo '- 版本不符合'
### 2)with-compat 查询
nginx -V 2>&1 | grep -o with-compat && echo '* compat 支持' || echo '- compat 不支持'
### 3)with-http_addition_module 查询
nginx -V 2>&1 | grep -o with-http_addition_module && echo '* addition 模块已安装' || echo '- addition 模块未安装'
### 4)合成命令
nginx -v 2>&1 | awk -F ' |/' '{print $4}' | grep -E '1.18.0' && echo '* 版本符合' || echo '- 版本不符合' && nginx -V 2>&1 | grep -o with-compat && echo '* compat 支持' || echo '- compat 不支持' && nginx -V 2>&1 | grep -o with-http_addition_module && echo '* addition 模块已安装' || echo '- addition 模块未安装'
返回结果含有三颗 * 即满足安装条件! ## (二)Nginx 安装参考 ### 1)yum 安装(最新稳定版) ``` vim /etc/yum.repos.d/nginx.repo ``` ```gray [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true ``` ``` yum -y install nginx ``` 官方参考:http://nginx.org/en/linux_packages.html ### 2)编译安装 当前仅支持大于等于 1.18.0 (2020-04-21以后) 的稳定版 [编译安装参考](/暂未分类/安装/200622-02-编译安装nginx/) ## (三)安装 Qpress 模块 ### 1)RPM 安装 ```gray rpm -qa | grep walle-qpress #查看 walle-qpress 是否已经安装 ``` ```blue rpm -Uvh http://qpress.net/down/rpm/walle-qpress-2.20.1-1.el7.noarch.rpm ``` ```gray rpm -ql walle-qpress #查看包内文件 ``` ```gray rpm -e walle-qpress #卸载 ``` ### 1+)YUM 安装 ```blue wget -O /etc/yum.repos.d/walle.repo http://qpress.net/down/yum/repo/walle.repo #下载 REPO 文件 ```
yum clean all && yum makecache #更新本地 YUM 缓存
```gray yum list installed walle-qpress #查询是否安装 ``` ```blue yum -y install walle-qpress #安装 ``` ```gray yum -y remove walle-qpress #删除 ``` ### 2)下载模板文件 在站点目录下操作! 样式一: ``` wget http://qpress.net/down/ui/ui-one.zip #下载 ``` ``` unzip ui-one.zip #解压 ```
wget http://qpress.net/down/ui/ui-one.zip && unzip ui-one.zip #合成命令
样式二: ``` wget http://qpress.net/down/ui/ui-two.zip #下载 ``` ``` unzip ui-two.zip #解压 ``` ### 3)简单配置(参考) ``` vim .static/.js/conf/conf.js ``` 通用(样式一、样式二): ```gray page_title #页面title(全站) last_year #最早文章年份(归档页) get_tag_flag #是否获取tag(详情页) ``` 仅样式二: ```gray site_title #左上角title menu_arr #菜单 ``` ### 4)模板定制(可选) 可以参照模板文件定制成自己喜欢的任意样式!! ## (四)配置 Qpress 模块 ### 1)编辑 nginx 配置 ``` vim /etc/nginx/nginx.conf ``` 在 events { 上面加入: ```blue include /walle/qkit/qpress/conf/qpress-main.conf; #Qp.1 ``` 或 ``` load_module "/walle/qkit/qpress/so/ngx_http_qpress_module-1.18.0.so"; ``` ### 2)编辑对应的 Nginx 站点配置 ```gray vim /etc/nginx/conf.d/default.conf ``` ```gray server { ... } ``` 在 server 块内,添加配置: ```blue include /walle/qkit/qpress/conf/qpress-server.conf; #Qp.2 ``` 或 ``` # Qpress.s # # list location / { #style.list add_before_body /.static/.html/.header_list.html; add_after_body /.static/.html/.footer_list.html; #index qpress on; } # article location ~ \.html$ { internal; #style.article add_before_body /.static/.html/.header_detail.html; add_after_body /.static/.html/.footer_detail.html; } # version location = /.static/ { internal; #version qpress on; } location = /qpress { #rewrite rewrite /qpress /.static/; } # search location /.static/.search/ { internal; #style.search add_before_body /.static/.html/.header_search.html; add_after_body /.static/.html/.footer_search.html; #search qpress on; qpress_format search; } location = /search { #/search?para #rewrite rewrite /search /.static/.search/; } # search-t location /.static/.search-t/ { internal; #style.search add_before_body /.static/.html/.header_search.html; add_after_body /.static/.html/.footer_search.html; #search qpress on; qpress_format search-t; } location = /search-t { #/search?para #rewrite rewrite /search-t /.static/.search-t/; } # tag location /.static/.tag/ { internal; #style.tag add_before_body /.static/.html/.header_tag.html; add_after_body /.static/.html/.footer_tag.html; #search qpress on; qpress_format tag; } location = /tag { #/tag?para #rewrite rewrite /tag /.static/.tag/; } # get-tag location /.static/.get-tag/ { internal; #search qpress on; qpress_format get-tag; } location = /get-tag { #/get-tag?para #rewrite rewrite /get-tag /.static/.get-tag/; } # archive location /.static/.archive/ { internal; #style.archive add_before_body /.static/.html/.header_archive.html; add_after_body /.static/.html/.footer_archive.html; #search qpress on; qpress_format archive; } location = /archive { #/archive?para #rewrite rewrite /archive /.static/.archive/; } # Qpress.e # ``` ### 3)默认编码 确认编码是否为 utf-8,不是请添加如下配置: ``` charset utf-8; #影响中文文件名长度 ``` ### 4)重启 nginx ``` pkill nginx ``` ``` nginx ``` ## (五)Qpress 版本查看 http://你的网站域名或IP地址/qpress 示例:http://nginx.co/qpress