我想将进入端口80上运行的服务器的所有请求重定向到运行端口443的上游。
我正在尝试使用以下配置。但它不起作用
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
keepalive_timeout 65;
client_max_body_size 500M;
#timeouts
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 1m;
send_timeout 600;
upstream backend {
server developers.facebook.com:443;
keepalive 64;
}
#
# The default server
#
server {
listen 80;
server_name http_server;
error_log /var/log/nginx/error.log debug;
location /products {
rewrite ^/products/(.*) /$1/$2 break;
proxy_pass https://backend;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
#proxy_set_header Connection "";
#proxy_http_version 1.1;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_session_reuse on;
}
# redirect not found pages to the static page /404.html
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
我尝试使用sudo nginx -t -c /etc/nginx/nginx.conf
验证nginx配置时出现以下错误,
nginx: [emerg] unknown directive "proxy_ssl_verify" in /etc/nginx/nginx.conf:44
nginx: configuration file /etc/nginx/nginx.conf test failed
我是否需要提供证书才能访问developers.facebook.com:443?
我正在使用nginx version: nginx/1.6.2
有人可以帮我这个吗?