lnmp新增https访问【转】
环境是使用lnmp一键安装包搭建的;
1 首先去这个网站下载证书:免费ssl证书
最终会得到两个文件
2:在/usr/local/nginx/conf创建cert目录把这两个文件放进去,这个地址后面有用。
编辑/usr.local/nginx/conf/nginx.conf:添加下面这段:
server {
listen ;
server_name www.domain.cn; #这里改成你的
ssl on;
root /home/wwwroot/default; #你的地址
#下面两个是上面下载的两个文件地址
ssl_certificate /usr/local/nginx/conf/cert/full_chain.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/private.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. TLSv1.; ssl_prefer_server_ciphers on;
index index.php index.html index.htm; # 优先解析php文件 # 匹配后缀为php的文件
location ~ \.php?.*$
{
root /home/wwwroot/default; # 设置网站根目录
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
location /nginx_status
{
stub_status on; access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/access.log;
}
注意最终格式是http:{server{}}不要把这段写在http外面了
如果有概率出现:No input file specified.但是重启php后正常
vim fastcgi.conf
将下面这行,注释
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
然后,重启lnmp
转自
lnmp给网站增加https - 苏贺贺的个人博客 - CSDN博客 https://blog.csdn.net/qq_41179401/article/details/86104881
php 将http转化为https 小程序部署上线 - 媛媛*小怪兽 - 博客园 https://www.cnblogs.com/dennyxiao/p/9009905.html
lnmp新增https访问【转】的更多相关文章
- ubuntu安装nginx和设置网站https访问
安装nginx 在控制台 输入 sudo apt-get install nginx 等待安装成功之后.可以打开浏览器.输入你的域名或者ip地址会出现"Welcome to nginx!&q ...
- Nginx下配置网站ssl实现https访问
第一步:服务器环境,lnmp即Linux+Nginx+PHP+MySQL,本文中以我的博客为例,使用的是阿里云最低档的vps+免费的Linux服务器管理系统WDCP快速搭建的lnmp环境(同类产品还有 ...
- Nginx实现ssl一级、二级域名证书部署并用https访问代理转发服务器
1. 规划 域名 解析IP Nginx代理 htpps://www.devcult.com 47.88.10.155 htpps://auto.devcult.com 47.88.10.155 ...
- 安装配置ingress-nginx支持https访问
说明: 1.k8s版本:v1.23: 2.内网测试环境1台master,2台node节点,使用 DaemonSet+HostNetwork+nodeSelector 方式部署 ingress- ...
- Windows下Nginx配置SSL实现Https访问(包含证书生成)
Vincent.李 Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...
- Tomcat创建HTTPS访问,java访问https
一 https和ssL HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的 ...
- wdcp 下apache模式开启https访问,支持多站点
1.vi conf/httpd.conf 查找 #Include conf/extra/httpd-ssl.conf (删除行首的配置语句注释符号"#"保存退出) 2.vi con ...
- PHP curl https访问问题
PHP curl https访问问题,原代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /* @String url URL地址 * @Array data P ...
- 阿里云Ubuntu 14.04 + Nginx + let's encrypt 搭建https访问
参考页面: https://certbot.eff.org/#ubuntutrusty-nginx http://bbs.qcloud.com/thread-12059-1-1.html http:/ ...
随机推荐
- Winserver-FailoverCluster验证异常
Q:新建的2台物理机,组成一个集群,第一遍没有问题,建成后,我想重建所以就destroy掉了,但是在重建时报 错误,尝试了各种清除集群指令和重新安装failover等方法都无效. 以后不在使用Dest ...
- FSMN 及其变种 cFSMN DFSMN pyramidal-FSMN
原文: https://blog.csdn.net/qq_26778411/article/details/89682447 也可以参考: http://vsooda.github.io/2018/ ...
- C++中string::find()函数和string::npos函数的使用
1. string::find()函数和string::npos函数的介绍 我们在学习C++的时候必不可少的使用到string类中的find()函数,它是一个查找函数,功能还是很强大的,但是此处我们不 ...
- commons-io之FileUtils、IOUtils
原文:https://blog.csdn.net/justry_deng/article/details/93616705 commons-io简单说明:Common IO 是一个工具库,用来帮助开发 ...
- Redis与Python的交互
驱动模块 redis模块用来在Python环境下驱动Redis数据库 可以直接用pip方式安装 pip install redis 或者国内镜像下载: pip install -i https://p ...
- test20190504 行走
行走(walk.cpp/c/pas) 题目描述 "我有个愿望,我希望走到你身边." 这是个奇异的世界,世界上的 n-1 条路联结起来形成一棵树,每条路有一个对应的权值 ci. 现在 ...
- ORACLE11g:No Dialect mapping for JDBC type: -9解决方案
问题来源: 某个zhizhang同事不干活 好不容易干了个活 改了个字段长度,从varchar2(50) 改成了nvarchar(100) 结果因为方言问题,程序起不来了 字段类型也改不回来了 nnd ...
- 十四.Protobuf3扩展
在您发布使用Protocol Buffer区的代码后,您迟早会因为业务需求变更想要“改进”Protocol Buffer的定义.如果你想让你的新Protocol Buffer向后兼容,让你的旧Prot ...
- win32gui.EnumWindows
python2 import win32gui, win32con, win32api import time, math, random def _MyCallback( hwnd, extra ) ...
- java 反射获取字段为List类型中的泛型类型
在java编程时,经常会使用反射去处理对象,有时会需要知道List的泛型类型:示例操作如下 obj = pojo.newInstance(); // 首先得到pojo所定义的字段 Field[] fi ...