Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache X-Accel-Redirect不使用SSL_Apache_Ssl_Nginx_X Accel Redirect - Fatal编程技术网

Apache X-Accel-Redirect不使用SSL

Apache X-Accel-Redirect不使用SSL,apache,ssl,nginx,x-accel-redirect,Apache,Ssl,Nginx,X Accel Redirect,我正在使用Nginx的X-Accel-redirect功能,使用名为video2.php的php文件播放视频,代码如下: header("X-Accel-Redirect: /Restr/" . $file); (当然,以前有更多的可执行代码,现在不需要了) 我还有以下文件pla.php,其中嵌入了两个播放器: 第一个播放器名为sourcesrc=”http://example.com/video2.php“type=“video/mp4”,第二个作为源代码src=“video2.php”ty

我正在使用Nginx的
X-Accel-redirect
功能,使用名为video2.php的php文件播放视频,代码如下:

header("X-Accel-Redirect: /Restr/" . $file);
(当然,以前有更多的可执行代码,现在不需要了)

我还有以下文件pla.php,其中嵌入了两个播放器: 第一个播放器名为
sourcesrc=”http://example.com/video2.php“type=“video/mp4”
,第二个作为源代码
src=“video2.php”type=“video/mp4”

当我处于https模式时,第一个播放器工作,第二个不工作。 当我处于http模式时,两个播放器都工作。第一个播放器使用https播放,因为http中的完整链接

这意味着Nginx在除一种情况外的所有情况下都可以与SSL配合使用<当域设置为https时,code>X-Accel-redirect功能不起作用。它在http模式下工作得非常好

nginx.conf的

user nobody;

worker_processes auto;


error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events 
{
worker_connections 1024; 

use epoll; 

}

http 
{

open_file_cache max=5000 inactive=30s;

open_file_cache_valid 120s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
open_log_file_cache max=1024 inactive=30s min_uses=2;
server_names_hash_max_size 10240;
server_names_hash_bucket_size 1024;
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5;
gzip on;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_proxied any;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/xml text/css application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg application/xml+rss text/javascript application/atom+xml application/javascript application/json;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
client_max_body_size 200m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
proxy_temp_path /tmp/nginx_temp;
log_format bytes_log "$msec $bytes_sent .";

include /etc/nginx/conf.d/*.conf;
}
xxx.xxx.xxx.xx.conf中

server {
listen xxx.xxx.xxx.xx:82;
access_log /var/log/nginx/access.xxx.xxx.xxx.xx.log;
error_log /var/log/nginx/error.xxx.xxx.xxx.xx.log;
server_name xxx.xxx.xxx.xx;
root /usr/local/apache/htdocs;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot)\$ {
expires 7d; #Comment this out if you are using the apache backend cache-control/expires headers.
try_files \$uri \@backend;
}
error_page 405 = \@backend;
error_page 500 = \@custom;
add_header X-Cache "HIT from Backend";
proxy_pass http://xxx.xxx.xxx.xx:8181;
include proxy.inc;
}
location \@backend {
internal;
proxy_pass http://xxx.xxx.xxx.xx:8181;
include proxy.inc;
}
location \@custom {
internal;
proxy_pass http://xxx.xxx.xxx.xx:8181;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?\$ {
proxy_pass http://xxx.xxx.xxx.xx:8181;
include proxy.inc;
}
location ~ /\.ht {
deny all;
}
}
这里似乎是关键,所有设置都是仅http,而不是https

下面来自etc/nginx的
proxy.inc
代码/

proxy_buffering off;
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_hide_header Vary;
proxy_hide_header X-Powered-By;
proxy_set_header Accept-Encoding '';
#If you want to get the cache-control and expire headers from apache, comment out 'proxy_ignore_headers' and uncomment 'proxy_pass_header Expires;' and 'proxy_pass_header Cache-Control
#proxy_pass_header Expires;
#proxy_pass_header Cache-Control;
proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
任何帮助都将不胜感激