VPS侦探论坛

 找回密码
 注册
查看: 12348|回复: 9

[Apache] (已解决)配置SSL无法访问

[复制链接]
发表于 2014-2-6 01:51:24 | 显示全部楼层 |阅读模式

按照军哥以前的文章,配置了namecheap的SSl,配置好后https一直都是无法访问下面这段代码可以访问http,但是https无法访问。
  1. log_format  www.kudou.org  '$remote_addr - $remote_user [$time_local] "$request" '
  2.              '$status $body_bytes_sent "$http_referer" '
  3.              '"$http_user_agent" $http_x_forwarded_for';
  4. server
  5.         {
  6.                 listen       80;
  7.                 listen       443 ssl;
  8.                 ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
  9.                 ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
  10.                 ssl_session_timeout 5m;
  11.                 server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
  12.                 index index.html index.htm index.php default.html default.htm default.php;

  13.                 rewrite ^/wp-admin$ /wp-admin/ permanent;               
  14.                 root  /home/wwwroot/www.kudou.org;

  15.                 include wordpress.conf;
  16.                
  17.                 location ~ .*\.(php|php5)?$
  18.                         {
  19.                                 try_files $uri =404;
  20.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  21.                                 fastcgi_index index.php;
  22.                                 include fcgi.conf;
  23.                         }

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

  28.                 location ~ .*\.(js|css)?$
  29.                         {
  30.                                 expires      7d;
  31.                         }
  32.                 access_log  /home/wwwlogs/www.kudou.org.log  www.kudou.org;
  33.         }
复制代码

[ 本帖最后由 空裤兜 于 2014-2-15 23:04 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2014-2-6 01:52:36 | 显示全部楼层


分开添加server的代码如下,还是只能访问http,不能访问https
  1. log_format  www.kudou.org  '$remote_addr - $remote_user [$time_local] "$request" '
  2.              '$status $body_bytes_sent "$http_referer" '
  3.              '"$http_user_agent" $http_x_forwarded_for';
  4. server
  5.         {
  6.                 listen       80;
  7.                 server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
  8.                 index index.html index.htm index.php default.html default.htm default.php;
  9.                 if ($host != 'www.kudou.org') {
  10.         rewrite ^/(.*)$ http://www.kudou.org/$1 permanent;
  11. }
  12.                 rewrite ^/wp-admin$ /wp-admin/ permanent;               
  13.                 root  /home/wwwroot/www.kudou.org;

  14.                 include wordpress.conf;
  15.                
  16.                 location ~ .*\.(php|php5)?$
  17.                         {
  18.                                 try_files $uri =404;
  19.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  20.                                 fastcgi_index index.php;
  21.                                 include fcgi.conf;
  22.                         }

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

  27.                 location ~ .*\.(js|css)?$
  28.                         {
  29.                                 expires      7d;
  30.                         }
  31.                 access_log  /home/wwwlogs/www.kudou.org.log  www.kudou.org;
  32.         }
  33. server
  34.         {
  35.                 listen       443;
  36.                 server_name kudou.org www.kudou.org ;
  37.                 index index.html index.htm index.php default.html default.htm default.php;       
  38.                 root  /home/wwwroot/www.kudou.org;
  39.                 ssl on;
  40.                 ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
  41.                 ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
  42.                 ssl_session_timeout 5m;
  43.                 ssl_protocols SSLv2 SSLv3 TLSv1;
  44.                 ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  45.                 ssl_prefer_server_ciphers on;
  46.                 include wordpress.conf;
  47.                
  48.                 location ~ .*\.(php|php5)?$
  49.                         {
  50.                                 try_files $uri =404;
  51.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  52.                                 fastcgi_index index.php;
  53.                                 fastcgi_param  HTTPS on;
  54.                                 include fcgi.conf;
  55.                         }

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

  60.                 location ~ .*\.(js|css)?$
  61.                         {
  62.                                 expires      7d;
  63.                         }
  64.                 access_log  /home/wwwlogs/www.kudou.org.log  www.kudou.org;
  65.         }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2014-2-6 16:26:41 | 显示全部楼层

折腾了好久发现个奇怪的问题,首页和文章页显示空白页,但是状态码是200,后台却可以正常使用SSL

不知道哪里出问题了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-2-6 17:36:56 | 显示全部楼层



看配置是没有问题
/usr/local/nginx/sbin/nginx -t 测试看一下
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2014-2-6 17:39:27 | 显示全部楼层

回复 4# 的帖子


测试没有问题 上面两个配置文件都不提示错误  现在用的第二个 出现3楼所说的问题  好像是php执行的问题

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

 楼主| 发表于 2014-2-6 21:15:23 | 显示全部楼层

同一域名,wordpress的登陆页和后台能正常显示 其他页面空白
发表于 2014-2-6 22:29:37 | 显示全部楼层

fastcgi_param  HTTPS on; 去掉重启nginx试试
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2014-2-7 00:10:07 | 显示全部楼层

回复7# 的帖子


还是一样 http访问正常 https访问只能出现登陆页和后台,其他全部空白现在的配置文件是
  1. log_format  www.kudou.org  '$remote_addr - $remote_user [$time_local] "$request" '
  2.              '$status $body_bytes_sent "$http_referer" '
  3.              '"$http_user_agent" $http_x_forwarded_for';
  4. server
  5.         {
  6.                 listen       80;
  7.                 server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
  8.                 index index.html index.htm index.php default.html default.htm default.php;

  9.                 rewrite ^/wp-admin$ /wp-admin/ permanent;               
  10.                 root  /home/wwwroot/www.kudou.org;

  11.                 include wordpress.conf;
  12.                
  13.                 location ~ .*\.(php|php5)?$
  14.                         {
  15.                                 try_files $uri =404;
  16.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  17.                                 fastcgi_index index.php;
  18.                                 include fcgi.conf;
  19.                         }

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

  24.                 location ~ .*\.(js|css)?$
  25.                         {
  26.                                 expires      7d;
  27.                         }
  28.                 access_log  /home/wwwlogs/www.kudou.org.log  www.kudou.org;
  29.         }
  30. server
  31.         {
  32.                 listen       443;
  33.                 server_name kudou.org www.kudou.org ;
  34.                 index index.html index.htm index.php default.html default.htm default.php;       
  35.                 root  /home/wwwroot/www.kudou.org;
  36.                 ssl on;
  37.                 ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
  38.                 ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
  39.                 ssl_session_timeout 5m;

  40.                 include wordpress.conf;


  41. location ~ .*\.(php|php5)?$
  42. {
  43. fastcgi_pass  unix:/tmp/php-cgi.sock;
  44. fastcgi_index index.php;
  45. include fcgi.conf;
  46. }

  47.                 access_log  /home/wwwlogs/www.kudou.org.log  www.kudou.org;
  48.         }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2014-2-7 09:29:36 | 显示全部楼层

回复 8# 的帖子


这个配置是完全没有问题的,你在网站目录下创建个phpinfo.php 内容<?php phpinfo(); ?> 看看能正常显示吗
再找php-fpm日志看看

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

 楼主| 发表于 2014-2-7 10:36:08 | 显示全部楼层

回复 9# 的帖子




根目录下的phpinfo显示No input file specified。php-fpm日志文件没有提示错误
access.log有几行400 但是没有其他提示在include fcgi.conf;添加一行fastcgi_param  SCRIPT_FILENAME  /home/wwwroot/www.kudou.org$fastcgi_script_name;后,phpinfo可以显示,但是网站还是空白

[ 本帖最后由 空裤兜 于 2014-2-7 10:59 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-4 15:20 , Processed in 0.028919 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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