全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
12
返回列表 发新帖
楼主: ixbear

[nginx] 求技术帝:nginx下如何使 http 和 https 都能正常访问

[复制链接]
 楼主| 发表于 2010-10-16 17:26:27 | 显示全部楼层
原帖由 lsylsy2 于 2010-10-16 17:21 发表
把你配置贴一下
  1. server
  2.         {
  3.                 listen       80;
  4.                 listen       443;
  5.                 server_name www.aaa.com;
  6.                 index index.html index.htm index.php;
  7.                 root  /home/wwwroot;

  8. ssl    on;
  9. ssl_certificate    /root/aaa.crt;
  10. ssl_certificate_key     /root/aaa.key;
  11. ssl_session_timeout 5m;

  12. ssl_protocols SSLv2 SSLv3 TLSv1;
  13. ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  14. ssl_prefer_server_ciphers   on;

  15.                 location ~ .*\.(php|php5)?$
  16.                         {
  17.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  18.                                 fastcgi_index index.php;
  19.                                 fastcgi_param HTTPS on;
  20.                                 include fcgi.conf;
  21.                         }

  22.                 location /status {
  23.                         stub_status on;
  24.                         access_log   off;
  25.                 }

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

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

  34.                 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  35.              '$status $body_bytes_sent "$http_referer" '
  36.              '"$http_user_agent" $http_x_forwarded_for';
  37.                 access_log  /home/wwwlogs/access.log  access;
  38.         }
复制代码
 楼主| 发表于 2010-10-16 17:27:35 | 显示全部楼层
location ~ .*\.(php|php5)?$里面有个 fastcgi_param HTTPS on;
我试过  不论加上这句 还是去掉这句  问题都一样
发表于 2010-10-16 17:42:02 | 显示全部楼层
分别写http和https,应该没问题的
 楼主| 发表于 2010-10-16 17:50:18 | 显示全部楼层
原帖由 icest 于 2010-10-16 17:42 发表
分别写http和https,应该没问题的


有问题,我分别新建了两个server,问题是一样的,仍是会出现 400错误
server
        {
                listen       80;
                server_name www.aaa.com;
                index index.html index.htm index.php;
                root  /home/wwwroot;
                .....
        }


server
        {
                listen       443;
                server_name www.aaa.com;
                index index.html index.htm index.php;
                root  /home/wwwroot;
                .....
        }
发表于 2010-10-16 18:15:03 | 显示全部楼层
我就是分别写的。。没问题。。
难道是RP
 楼主| 发表于 2010-10-16 18:16:48 | 显示全部楼层
原帖由 卡恩 于 2010-10-16 18:15 发表
我就是分别写的。。没问题。。
难道是RP


把你的代码帖出来看看嘛   要是不方便,就发我邮箱i@zhukun.net 顺便把网址发一下 我试试看   谢谢了!
发表于 2010-11-9 10:16:35 | 显示全部楼层
server {
listen 80;
listen 443;

ssl on;
ssl_certificate /xxx.crt;
ssl_certificate_key /xxxx.key;

..............................

}
发表于 2010-11-9 12:58:00 | 显示全部楼层
ssl on;   
ssl_certificate server.crt;   
ssl_certificate_key server.key;   
error_page 497 "https://$host$uri?$args";  
用这个看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-16 18:37 , Processed in 0.061831 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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