我在 ubuntu 18.04 LTS 上有一个 nginx 1.15.3 服务器,我试图使用 wordpress 网站上的各种插件来提供网页或视频内容,而这个网站完全在另一个服务器/IP 上。但是,当我尝试在该网站上使用高级 iframe 模块来拉取一个只有视频流的网页时(它在这里起作用了:http://www.tinywebgallery.com/blog/advanced-iframe/free-iframe-checker),它表示 nginx 服务器的 IP 拒绝连接,这也适用于我尝试建立的任何其他类型的连接,或者我尝试提取我需要的任何视频流。无论发生什么,都与 nginx 如何与 wordpress 交互或反之亦然有关,我真的不确定。另一台服务器上的 wordpress 版本是 4.9.8,因此一切都应该是最新的。
这是我的 nginx.conf:
worker_processes auto;
events {
worker_connections 1024;
}
# RTMP configuration
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4096;
application show1 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls1/;
hls_fragment 3;
hls_playlist_length 60;
}
application show2 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls2/;
hls_fragment 3;
hls_playlist_length 60;
}
application show3 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls3/;
hls_fragment 3;
hls_playlist_length 60;
}
application show4 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls4/;
hls_fragment 3;
hls_playlist_length 60;
}
application show5 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls5/;
hls_fragment 3;
hls_playlist_length 60;
}
application show6 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls6/;
hls_fragment 3;
hls_playlist_length 60;
}
application show7 {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls7/;
hls_fragment 3;
hls_playlist_length 60;
}
application cam01 {
live on;
record off;
}
application cam02 {
live on;
record off;
}
application cam03 {
live on;
record off;
}
application cam04 {
live on;
record off;
}
application cam05 {
live on;
record off;
}
application cam06 {
live on;
record off;
}
application cam07 {
live on;
record off;
}
}
}
http {
sendfile off;
tcp_nopush on;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
location / {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /mnt/;
location /index.html {
default_type "text/html";
}
location /testing.html {
default_type "text/html";
}
location /test.html {
default_type "text/html";
}
location /cam01.html {
default_type "text/html";
}
location /cam02.html {
default_type "text/html";
}
location /cam03.html {
default_type "text/html";
}
location /cam04.html {
default_type "text/html";
}
location /cam05.html {
default_type "text/html";
}
location /cam06.html {
default_type "text/html";
}
location /cam07.html {
default_type "text/html";
}
}
}
}
我对 wordpress、nginx 和 serverfault 还不太熟悉,所以如果需要更多信息,请随时询问,我会提供。任何帮助都将不胜感激,谢谢。
答案1
好的,所以听从了 Michael Hampton 的建议,检查了网页上的 Web 控制台是否存在错误。我发现 nginx 通过 http 而不是 https 提供所有服务,而我使用 https 请求 wordpress 网站时,导致出现某种混合内容错误,这可能与我到处使用 https 的方式无关。使用常规 http 请求网页可正常加载内容。谢谢您的帮助!