河北省建设厅网站官网,无锡企业网站建设费用,织梦导入wordpress,廊坊网站建设推广经验目录
一、Nginx的安装与配置
安装步骤
二、SSL证书获取
三、Nginx配置 前题条件#xff0c;拥有服务器与可以解析到该服务器的自己的域名。
一、Nginx的安装与配置
若已安装好了Nginx#xff0c;则需查看自己的Nginx是否开启了SSL的模块功能#xff1a;
./nginx -V 显…目录
一、Nginx的安装与配置
安装步骤
二、SSL证书获取
三、Nginx配置 前题条件拥有服务器与可以解析到该服务器的自己的域名。
一、Nginx的安装与配置
若已安装好了Nginx则需查看自己的Nginx是否开启了SSL的模块功能
./nginx -V 显示如上则代表ssl功能已开启否则可能出现以下错误提示
nginx: [emerg] the ssl parameter requires ngx_http_ssl_module in /usr/local/nginx.conf:%
解决方案见
nginx: [emerg] the ssl parameter requires ngx_http_ssl_module in /usr/local/nginx.conf:% - 简书
安装步骤
1.官网下载nginx压缩包 nginx: download http://nginx.org/en/download.html 我们先去官网下载一个最新稳定版的nginx 然后使用xftp或者rz上传到我们的服务器
# 解压压缩包
tar -zxvf nginx-1.22.1.tar.gz 然后进入到目录里面查看是否有可执行权限(是不是绿色的)没有赋予执行权限
# 赋予执行权限
chmod x configure
2.安装nginx所需要的环境 在安装之前先安装nginx所需要的一些环境
# c编译器
yum -y install gcc gcc-c autoconf automake make
# 解析正则的pcre库
yum install -y pcre pcre-devel
# 添加对gzip的支持
yum install -y zlib zlib-devel
# SSL
yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel
3、开始安装
./configure --prefix/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
二、SSL证书获取
可以使用openssl.cn获取免费的证书
百度安全验证
三、Nginx配置
将获取的ssl证书放到服务器上配置相应的路径。 server {listen 80;#填写绑定证书的域名server_name dragonwu.xyz;#charset koi8-r;#access_log logs/host.access.log main;#强制将http的URL重写成httpsreturn 301 https://$host$request_uri;}server {listen 443 ssl;server_name dragonwu.xyz; #你的域名ssl_certificate /usr/local/ssl/dragonwu.xyz_cert_chain.pem; #证书ssl_certificate_key /usr/local/ssl/dragonwu.xyz_key.key; #证书ssl_session_cache shared:SSL:1m;ssl_session_timeout 5m;ssl_ciphers HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers on;location / {root html;index index.html index.htm;}}
Nginx服务器重新加载
./nginx -s reload 注意事项443端口一定要打开之前我就是因为443端口被防火墙保护一直访问不到开放443端口即可 总结完毕