我需要设置Nginx,以便它响应http和https请求;我以这种方式配置了默认的conf:
server {
listen 80;
listen 443;
ssl on;
ssl_certificate /etc/nginx/certs/domain-bundle.crt;
ssl_certificate_key /etc/nginx/certs/domain.it.key;
server_name static.domain.it;
location / {
try_files $uri @s3cache;
}
location @s3cache{
proxy_cache S3CACHE;
proxy_cache_valid 200 48h;
proxy_cache_valid 403 60m;
proxy_pass http://static.domain.it.s3-external-3.amazonaws.com;
}
}https协议运行良好,但如果我发出http请求,则会得到以下错误:
400 Bad Request
The plain HTTP request was sent to HTTPS port发布于 2014-12-23 11:13:25
ssl指令为整个vhost启用SSL,而不查看端口号。如果要将SSL限制为单个端口,请替换:
listen 80;
listen 443;
ssl on;出自:
listen 80;
listen 443 ssl;https://unix.stackexchange.com/questions/175600
复制相似问题