网站首页 > 技术教程 正文
环境是使用lnmp一键安装包搭建的;
1 首先去这个网站下载证书:免费ssl证书
最终会得到两个文件
2:在/usr/local/nginx/conf创建cert目录把这两个文件放进去,这个地址后面有用。
编辑/usr.local/nginx/conf/nginx.conf:添加下面这段:
server {
listen 443;
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.1 TLSv1.2; 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
猜你喜欢
- 2024-10-02 Mac安装Nginx、Mysql、PHP、Redis
- 2024-10-02 Docker Compose安装使用,及搭建nginx+php+mysql基础应用实例
- 2024-10-02 CentOS7编译安装PHP7的详细教程(图文)
- 2024-10-02 Docker部署WordPress LNMP环境实践
- 2024-10-02 一款免费开源的PHP建站CMS系统(良心大大的好)
- 2024-10-02 php代码连不上mysql的可能?看看这个也许能给你点启发
- 2024-10-02 安装nginx +uwsgi+ Django(安装抖音)
- 2024-10-02 linux中docker配置nginx+php+mysql+thinkphp完整案例
- 2024-10-02 CentOS、Nginx、PHP、MySQL的安装和配置记录
- 2024-10-02 如何查看已经安装的nginx、apache、mysql和php的编译参数
欢迎 你 发表评论:
- 12-17卸载360安全浏览器(如果卸载360浏览器)
- 12-17装机助理重装系统靠谱吗(装机助理好用吗)
- 12-17微软官方win10工具(微软windows工具)
- 12-17系统之家园(系统家园的系统安全吗)
- 12-17win7产品密钥永久激活码最新
- 12-17分区工具怎么用(分区工具教程)
- 12-17数据库软件有哪几种(数据库说白了是干什么的)
- 12-17wms系统(WMS系统的功能有哪些)
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)

本文暂时没有评论,来添加一个吧(●'◡'●)