(已解决)配置SSL无法访问
按照军哥以前的文章,配置了namecheap的SSl,配置好后https一直都是无法访问下面这段代码可以访问http,但是https无法访问。log_formatwww.kudou.org'$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80;
listen 443 ssl;
ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
ssl_session_timeout 5m;
server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
index index.html index.htm index.php default.html default.htm default.php;
rewrite ^/wp-admin$ /wp-admin/ permanent;
root/home/wwwroot/www.kudou.org;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log/home/wwwlogs/www.kudou.org.logwww.kudou.org;
}
[ 本帖最后由 空裤兜 于 2014-2-15 23:04 编辑 ] 分开添加server的代码如下,还是只能访问http,不能访问httpslog_formatwww.kudou.org'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80;
server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
index index.html index.htm index.php default.html default.htm default.php;
if ($host != 'www.kudou.org') {
rewrite ^/(.*)$ http://www.kudou.org/$1 permanent;
}
rewrite ^/wp-admin$ /wp-admin/ permanent;
root/home/wwwroot/www.kudou.org;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log/home/wwwlogs/www.kudou.org.logwww.kudou.org;
}
server
{
listen 443;
server_name kudou.org www.kudou.org ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/www.kudou.org;
ssl on;
ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_paramHTTPS on;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log/home/wwwlogs/www.kudou.org.logwww.kudou.org;
} 折腾了好久发现个奇怪的问题,首页和文章页显示空白页,但是状态码是200,后台却可以正常使用SSL
不知道哪里出问题了 看配置是没有问题
/usr/local/nginx/sbin/nginx -t 测试看一下
回复 4# 的帖子
测试没有问题 上面两个配置文件都不提示错误现在用的第二个 出现3楼所说的问题好像是php执行的问题 同一域名,wordpress的登陆页和后台能正常显示 其他页面空白 fastcgi_paramHTTPS on; 去掉重启nginx试试回复7# 的帖子
还是一样 http访问正常 https访问只能出现登陆页和后台,其他全部空白现在的配置文件是log_formatwww.kudou.org'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80;
server_name kudou.org kongkudou.com www.kudou.org www.kongkudou.com;
index index.html index.htm index.php default.html default.htm default.php;
rewrite ^/wp-admin$ /wp-admin/ permanent;
root/home/wwwroot/www.kudou.org;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log/home/wwwlogs/www.kudou.org.logwww.kudou.org;
}
server
{
listen 443;
server_name kudou.org www.kudou.org ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/www.kudou.org;
ssl on;
ssl_certificate /usr/local/nginx/conf/kudou_org.crt;
ssl_certificate_key /usr/local/nginx/conf/kudou.pem;
ssl_session_timeout 5m;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
access_log/home/wwwlogs/www.kudou.org.logwww.kudou.org;
}
回复 8# 的帖子
这个配置是完全没有问题的,你在网站目录下创建个phpinfo.php 内容<?php phpinfo(); ?> 看看能正常显示吗再找php-fpm日志看看
回复 9# 的帖子
根目录下的phpinfo显示No input file specified。php-fpm日志文件没有提示错误access.log有几行400 但是没有其他提示在include fcgi.conf;添加一行fastcgi_paramSCRIPT_FILENAME/home/wwwroot/www.kudou.org$fastcgi_script_name;后,phpinfo可以显示,但是网站还是空白
[ 本帖最后由 空裤兜 于 2014-2-7 10:59 编辑 ]
页:
[1]