【发布时间】:2015-01-08 16:47:04
【问题描述】:
我正在尝试将所有 HTTP 流量重定向到 HTTPS,所以当我访问 www.domain.com 时,它会转到 https://www.domain.com。这是我当前的 .conf 文件 -
server {
listen 80;
#listen [::]:80;
server_name www.domain.net;
rewrite ^(.*) https://www.domain.net$1 permanent;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.domain.net;
include other.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;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/www.domain.net.log access; }
它总是为我的域返回一个“重定向循环”错误,我尝试了许多不同的配置,但我总是遇到同样的问题。 (感谢我的 SSL 没有按应有的方式配置,但它仍然有效)
如果有人可以帮助我使其正常工作,我将不胜感激。
【问题讨论】:
-
请把已经收录的other.conf和fastcgi.conf的内容贴出来
标签: http redirect ssl nginx https