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:/ ...
随机推荐
- Host is not allowed to connect to this MySQL server
解决方法: [root@GYQ-Prod-Zabbix ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Com ...
- django获取数据queryset中的filter选项
2.条件选取querySet的时候,filter表示=,exclude表示!=. querySet.distinct() 去重复__exact 精确等于 like 'aaa' __iexact 精确等 ...
- Maven简易笔记
Maven笔记 Maven笔记 Maven组成 安装配置 基本概念 Maven目录的典型结构 POM文件格式 GAV 依赖 依赖管理与父项目 关于父项目的一点主意事项 repository Maven ...
- yarn cluster和yarn client模式区别——yarn-cluster适用于生产环境,结果存HDFS;而yarn-client适用于交互和调试,也就是希望快速地看到application的输出
Yarn-cluster VS Yarn-client 从广义上讲,yarn-cluster适用于生产环境:而yarn-client适用于交互和调试,也就是希望快速地看到application的输出. ...
- 微信小程序API---数据缓存
本地数据缓存常用于存储多页面用到的数据,例如用户头像信息. (1)数据存储 wx.setStorage(Object object)与wx.setStorageSync(string key, any ...
- mysql.jdbc.Driver异常总结
1.registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web applic ...
- css Grid布局
CSS Grid 布局完全指南(图解 Grid 详细教程)https://www.html.cn/archives/8510#prop-grid-gap 5分钟学会 CSS Grid 布局https: ...
- Python读取csv内容
#encoding:utf-8 import csv csv_file=csv.reader(open("d://wu.csv","r"))print(csv_ ...
- linux autofs自动挂载
autofs:自动挂载器 自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的NFS挂载 自动挂载器由autofs服务脚本管理 自动挂载器由auto.master配置文件进行配 ...
- 原创!ngxtop-监控nginx的利器!!!
原创!ngxtop-监控nginx的利器!!! 无论名称还是界面,ngxtop的灵感均源自大名鼎鼎的top命令.ngxtop的功能就是,分析Nginx访问日志文件(以及其他日志文件,比如Apache2 ...