在CentOS下使用ngx_http_google_filter_module
来源:互联网 发布:淘宝怎么取消延长收货 编辑:程序博客网 时间:2024/06/15 18:48
安装Git&GCC
yum -y update && yum -y groupinstall "Development Tools" && yum -y install git gcc make epel-release下载组件
wget http://nginx.org/download/nginx-1.8.0.tar.gz && wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz" && wget "https://www.openssl.org/source/openssl-1.0.1j.tar.gz" && wget "http://zlib.net/zlib-1.2.11.tar.gz" && git clone https://github.com/cuber/ngx_http_google_filter_module && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module解压缩
tar xzvf nginx-1.8.0.tar.gz && tar xzvf pcre-8.38.tar.gz && tar xzvf openssl-1.0.1j.tar.gz && tar xzvf zlib-1.2.11.tar.gz添加用户,可以在nginx.conf配置文件中修改
groupadd www && useradd -s /sbin/nologin -g www www进入Nginx目录,编译
cd nginx-1.8.0
./configure \ --prefix=/usr/local/nginx-1.8.0 \ --with-pcre=../pcre-8.38 \ --with-openssl=../openssl-1.0.1j \ --with-zlib=../zlib-1.2.11 \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_spdy_module \ --with-http_gzip_static_module \ --with-ipv6 \ --with-http_sub_module \ --add-module=../ngx_http_google_filter_module \ --add-module=../ngx_http_substitutions_filter_modulemake
make && make installSSL证书
申请证书的网址:https://zerossl.com/free-ssl/#self
网站会提示下载两个文件,一个是crt.txt 文件,一个是key.txt文件,这两个就是证书和秘钥
当然你要使用的话需要修改一下域名,你还可以使用openssl命令或者使用Let’s Encrypt
随便你使用哪个都可以,个人喜欢使用这个网址简单几步操作就可以了
把证书上传到服务器上
Nginx设置
mkdir /usr/local/nginx-1.8.0/conf/vhostcd /usr/local/nginx-1.8.0/conf/vi nginx.conf在底部加入:
include vhost/*.conf;然后保存并退出。
cd vhostvi gotogoogle.conf加入以下内容,根据自己实际需要修改:
server { server_name <你的域名>; listen 443; ssl on; ssl_certificate <你的证书>; ssl_certificate_key <你的私钥>; resolver 8.8.8.8; location / { google on; google_scholar on; }}upstream www.google.com { server 216.58.216.196:443; server 216.58.216.195:443; server 216.58.216.194:443; server 216.58.216.193:443; server 216.58.216.192:443;}Start Nginx
/usr/local/nginx-1.8.0/sbin/nginx -c /usr/local/nginx-1.8.0/conf/nginx.conf如果修改了配置文件:
/usr/local/nginx-1.8.0/sbin/nginx -s reload访问:https://你的域名
最后,注明,一切步骤操作完成之后,记住需要关闭vps的防火墙,或者是增加端口,我就是忘记了防火墙的原因,在这卡了好久;如果不知道如何申请域名,请看我另一份博客申请免费域名
推荐使用命令:
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload
阅读全文
0 0
- 在CentOS下使用ngx_http_google_filter_module
- 在centos 下安装和使用MySQL
- 在centos 下安装和使用MySQL
- 使用yum在centos下安装ffmpeg
- 使用sentmail在centos下发送邮件
- Docker 在 CentOS 下的安装、使用
- minicom在centos和windows下使用
- 在 CentOS 下安装使用 XWiki
- 网络模拟器GNS3在CentOS系统下的安装使用
- [转载]在Window下使用VNC远程桌面CentOS/Redhat
- 终于可以在centos下使用QQ啦!
- Centos在wine下各软件使用(qq/迅雷
- CentOs在不联网的情况下,成功使用yum!!
- 使用yum在centos下安装最新版的ffmpeg
- infiniDB在linux(centos系统)下的安装使用
- 在Centos Linux下,使用MD5头文件
- 在CentOS 6.5下的virtualenvwrapper的使用
- git与github在centos下的使用
- uikit——Auto Layout——UIView——margin
- [转]在windows7系统下安装MySQL5.7.19免安装版
- 代理模式
- 求二叉树中两个节点的最近公共祖先
- PDF Expert for Mac 最新破解版 激活版 官网正式版
- 在CentOS下使用ngx_http_google_filter_module
- QT实现U盘监控
- [数学+枚举]BZOJ 4921——互质序列
- 面向对象基本语法
- vue注册组件的几种方式
- String、StringBuffer和StringBuilder之间的区别
- css去除chrome浏览器输入框默认样式填充及chrome浏览器滚动条样式设置
- this.class.getClassLoader().getResourceAsStream(path)
- 静态缓存