lnmp1.5一键环境包如何配置阿里云免费ssl并更新WordPress常规配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35461287/article/details/89881935

首先去阿里云搜素ssl并申请免费ssl证书

1:申请安全证书

进入阿里云->域名管理->点击管理   就可以找到就可以免费下载一年的安全证书

    

然后点击证书下载

                                       然后通过xshell或者其他客户端软件远程链接到服务器,cd /usr/local/nginx/conf 如果没有ssl目录 自己创建mkdir ssl    并且chmod 777 ssl

然后最关键的一步        vim     /usr/local/nginx/conf/nginx.conf     复制以下代码

user  www www;
worker_processes auto;
error_log  /home/wwwlogs/nginx_error.log  crit;
pid        /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
multi_accept on;
}
http
{
include       mime.types;
default_type  application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile   on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied   expired no-cache no-store private auth;
gzip_disable   "MSIE [1-6]\.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
server_tokens off;
access_log off;
server {
listen 443;
server_name blog.zcs8.cn;  //填写你自己的域名
ssl on;
root  /home/wwwroot/wordpress; //指定你的项目根目录
index index.html index.htm;
ssl_certificate /usr/local/nginx/conf/ssl/2157769_blog.zcs8.cn.pem; //填写你阿里云ssl申请的.pem
ssl_certificate_key /usr/local/nginx/conf/ssl/2157769_blog.zcs8.cn.key;//填写你阿里云ssl申请的.key
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;
include enable-php.conf;

location /nginx_status
{
stub_status on;
access_log   off;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires      30d;
}

location ~ .*\.(js|css)?$
{
expires      12h;
}

location ~ /.well-known {
allow all;
}

location ~ /\.
{
deny all;
}
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}

if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}

if (!-f $request_filename){
rewrite (.*) /index.php;
}
access_log  /home/wwwlogs/access.log;
}
include vhost/*.conf;
}

 然后xshell命令输入  nginx -t

如何返回successful的字样说明配置无明显格式错误,如何输入 nginx -s reload 接着输入 service nginx restart 接着 cd lnmp1.5 输入 lnmp reload

最后登录到自己的WordPress网站后台->设置->常规

原文来自我的个人博客网站,文章实时更新

阿里云学生机1年114元限时活动(24岁以下都可以购买)https://promotion.aliyun.com/ntms/act/campus2018.html?userCode=a6violqw阿里云1888元红包:https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=a6violqw

猜你喜欢

转载自blog.csdn.net/qq_35461287/article/details/89881935