VPS侦探论坛

 找回密码
 注册
查看: 4282|回复: 5

SSL在lnmp1.3下碰到的问题

[复制链接]
发表于 2016-2-29 12:27:18 | 显示全部楼层 |阅读模式

server
{
listen 443 ssl;   //如果需要spdy也可以加上,lnmp1.2及其后版本都默认支持spdy,lnmp1.3 nginx 1.9.5以上版本默认支持http2
server_name www.www.www;     //这里是你的域名
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.www.www;            //网站目录
ssl_certificate /root/ssl/www.crt;    //前面生成的证书,改一下里面的域名就行,不建议更换路径
ssl_certificate_key /root/ssl/www.key;   //前面生成的密钥,改一下里面的域名就行,不建议更换路径
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;

include none.conf;  //这个是伪静态根据自己的需求改成其他或删除
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;     //lnmp 1.0及之前版本替换为include fcgi.conf;
#include pathinfo.conf;
}

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

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

access_log off;
}

按照军哥的配置,可是打开域名还是Http,路径无论怎么改都是到/home/wwwroot/
发现个问题,LNMP1.3,上传的文件我用root账号在winscp都不能改文件权限组

只有root组,文件默认是644
我在conf文件顶部加user root;就可以了

这个怎么破???军哥请解答一下


server
    {
        #listen 80;

listen 443 ssl;
        #listen [::]:80;

ssl on;
        server_name www.sssss.cc;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.sshub.cc;
ssl_certificate /root/ssl/ssss.crt;
ssl_certificate_key /root/ssl/ssss.key;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;


用上边这个配置后,不用user root 也正确了,可是直接输入域名,默认还是http

手动输入https访问已经正确,可是要怎么设置默认都是Https???
搜索解决了,把80端口跳转到https://
server {  
    listen 80;  
    server_name www.sshub.cc;  

    rewrite ^(.*)$  https://$host$1 permanent;  
}

[ 本帖最后由 uijk123 于 2016-2-29 13:17 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-2-29 12:29:30 | 显示全部楼层


手动加https:// ,提示403
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-2-29 12:36:36 | 显示全部楼层

重启Lnmp提示 [emerg] unknown directive "//如果需要spdy也可以加上,lnmp1.2及其后版本都默认支持
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-2-29 12:42:39 | 显示全部楼层



奇怪了,不用SSL,默认的配置conf访问也变403了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2016-2-29 13:09:55 | 显示全部楼层

/usr/local/nginx/sbin/nginx -t 测试配置

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2016-2-29 13:18:46 | 显示全部楼层

回复 5# 的帖子


感谢军哥回复,已经解决了,过程已贴出
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-28 23:31 , Processed in 0.027255 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表