我正在尽我所能打开我的网站上的SSL。不过,我对nginx配置文件相当陌生。我下面的代码给了我一个重定向循环。我究竟做错了什么?Nginx和SSL让我重定向循环
server {
listen 80;
server_name website.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/ssl/www_website_com_final.crt;
ssl_certificate_key /etc/ssl/www_website_com.key;
root /var/www/website.com/htdocs/public;
index index.php index.html index.htm;
auth_basic "Restricted";
auth_basic_user_file /var/www/website.com/htdocs/.htpasswd;
server_name www.website.com;
#browse folders if no index file
#autoindex on;
# serve static files directly
#location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
# access_log off;
# expires max;
#}
location/{
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
ServerFault上应该询问服务器配置问题,而不是StackOverflow。 – 2014-10-11 10:31:58