小编Pla*_*ard的帖子

403禁止 - Nginx - 使用正确的凭据

我正在尝试密码保护我的Nginx支持的网站上的目录,其中包含phpMyAdmin,MemcacheMyAdmin和更多管理实用程序.

此目录位于我的站点的根目录中:

domain.com/control/
Run Code Online (Sandbox Code Playgroud)

我服务器上的绝对路径是:

/home/deployer/sites/domain.com/control/
Run Code Online (Sandbox Code Playgroud)

我使用以下命令在目录中创建了一个.htpasswd文件:

htpasswd -c /home/deployer/sites/domain.com/control/.htpasswd admin
Run Code Online (Sandbox Code Playgroud)

该文件存在,由"root"用户拥有,并且是0644权限.

在Nginx中此域的.conf文件中,我使用以下位置块来要求身份验证.

  location /control {
    auth_basic            "Restricted Area: Control";
    auth_basic_user_file  /home/deployer/sites/domain.com/control/.htpasswd;
  }
Run Code Online (Sandbox Code Playgroud)

当进入受密码保护的目录时,系统会提示我输入用户名和密码.我输入我之前创建的凭据,然后我会看到错误403禁止页面.

访问日志显示我正在访问登录提示,然后以"admin"用户身份登录:

64.123.456.225 - - [12/May/2013:17:30:48 +0000] "GET /control HTTP/1.1" 401 597 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
64.123.456.225 - admin [12/May/2013:17:30:48 +0000] "GET /control HTTP/1.1" 301 185 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
64.123.456.225 - admin [12/May/2013:17:30:59 +0000] "GET /control/memcache/ HTTP/1.1" 403 199 "-" "Mozilla/5.0 …
Run Code Online (Sandbox Code Playgroud)

nginx http-status-code-403 .htpasswd

8
推荐指数
2
解决办法
1万
查看次数

在iOS上的Cordova App中的iframe Youtube视频不再工作了

我的Cordova应用程序曾经能够将Youtube视频插入到页面中,并使用以下代码在iOS上使用iframe播放它们:

// youtube source URL
var src = 'https://www.youtube.com/embed/<VIDEOID>?autoplay=1&rel=0';

// iframe for everybody else
var element = 'iframe';

// x-ms-webview for windows app
if ( UTIL.isWindows() ) {
  element = 'x-ms-webview';
}


var $iframe = $( document.createElement( element ) );

$iframe.attr( 'id', 'streaming_video_player' );
$iframe.attr( 'width', '400' );
$iframe.attr( 'height', '300' );
$iframe.attr( 'frameborder', '0' );
$iframe.attr( 'allowfullscreen', 'allowfullscreen' );
$iframe.attr( 'src', url );

$('#video_container').html( $iframe );
				
Run Code Online (Sandbox Code Playgroud)

它仍然可以在Windows中使用x-ms-webview元素而不是iframe.

有时,我不知道什么时候,这停止了工作,它只是显示iframe所在的白框.我在Safari中检查了它,iframe正在插入,但Youtube的iframed页面是空白的.

不再需要Cordova的白名单插件,但我尝试添加它没有任何运气.

我还验证了我有以下按键影响plist中的媒体播放设置:

OpenAllWhitelistURLsInWebView = YES
MediaPlaybackRequiresUserAction = NO
AllowInlineMediaPlayback …
Run Code Online (Sandbox Code Playgroud)

youtube iframe xcode ios cordova

6
推荐指数
1
解决办法
1825
查看次数

标签 统计

.htpasswd ×1

cordova ×1

http-status-code-403 ×1

iframe ×1

ios ×1

nginx ×1

xcode ×1

youtube ×1