小编isa*_*ent的帖子

Nginx提供静态文件并禁止403

只是想帮助别人.是的,你只想使用nginx提供静态文件,你在nginx.conf中得到了一切:

location /static {
       autoindex on;
       #root /root/downloads/boxes/;
       alias /root/downloads/boxes/;
      }
Run Code Online (Sandbox Code Playgroud)

但是,最后,你失败了.你从浏览器得到"403禁止"......

---------------------------------------- 下面的答案: ------ ----------------------------------

解决方案非常简单:


方法1:以用户身份运行nginx作为'/ root/downloads/boxes /'所有者

nginx.conf中:

?user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
Run Code Online (Sandbox Code Playgroud)

是的,在第一行" #user noboy; "中,只需删除" # ",并在Linux/OS X中将" nobody " 更改为您自己的用户名,即更改为" root "进行测试.重启nginx.

注意,你最好不要以root身份运行nginx!这里只是为了测试,对黑客来说是危险的.

有关更多参考,请参阅nginx(引擎X) - BUM中的痛苦![13:许可被拒绝]


方式2:将'/ root/downloads/boxes /'所有者更改为'www-data'或'nobody'

终端:

ps aux | grep nginx
Run Code Online (Sandbox Code Playgroud)

获取运行nginx的用户名.应该是'www-data''nobody'由nginx的版本决定.然后点击终端(例如使用'www-data'):

chown -R www-data:www-data /root/downloads/boxes/
Run Code Online (Sandbox Code Playgroud)

------------------------------ 一件更重要的事情是: …

nginx uwsgi

47
推荐指数
7
解决办法
6万
查看次数

IOS Facebook SDK - 发布开放图表并在时间轴上显示而不单击活动日志

从Facebook SDK示例代码中,当成功将打开的图形对象发布到时间轴时,您必须在Facebook网站上的活动日志中单击时间轴上的显示.

如何忽略这些步骤并明确地将您的OG分享到时间表?

---------------------------------------- 下面的答案: ------ ----------------------------------

只需在FBOpenGraphAction对象中再添加一个代码:

id<FBOpenGraphAction> action = (id<FBOpenGraphAction>) [FBGraphObject graphObject];
[action setObject: @"true" forKey: @"fb:explicitly_shared"];  // This is the key point!
Run Code Online (Sandbox Code Playgroud)

您应该在网站的Facebook Developer App Dashboard中为开放图表操作启用"明确共享"设置.

有关更多详细信息,请查看有关显式共享文档

facebook facebook-graph-api ios facebook-opengraph facebook-ios-sdk

30
推荐指数
1
解决办法
3887
查看次数

IOS - performSelector:withObject:afterDelay:NOT WORKING

参考:

/sf/answers/1031887741/

就像上面说的链接一样,但似乎并没有解释原因.

在我的代码中,以下内容将起作用:

dispatch_async(dispatch_get_main_queue(), ^{
       [self performSelector:  @selector(helloWorld) withObject:nil afterDelay:0.5];
}); 
Run Code Online (Sandbox Code Playgroud)

但是,当我评论这样的事情时,(我确信我在主线程中运行它!!)代码不起作用:

//    dispatch_async(dispatch_get_main_queue(), ^{
        [self performSelector:  @selector(helloWorld) withObject:nil afterDelay: 0.5];
//    });
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我为什么吗? '自我',将神经释放/解除分配,我保留它直到申请结束.

"不工作",意味着,(没有崩溃)它不会跳转到"helloWorld"方法:

-(void) helloWorld {
    NSLog(@"hello world");     // I set a break point here for debug , it wouldn't pause forever
}
Run Code Online (Sandbox Code Playgroud)

我认为Run Loop会导致这个问题.喜欢这个链接说,但我需要更多细节或更明确的解释.

iphone objective-c ios

9
推荐指数
1
解决办法
8353
查看次数

UIImageView更改背景颜色和setImage在动画期间不起作用

正如标题所述,这很奇怪,您同意吗?

所以,如果有人找到您的密码

imageView.backgroundColor = [UIColor greenColor]; 
Run Code Online (Sandbox Code Playgroud)

要么

imageView.image = [UIImage imageName:@"angryBird"];" 
Run Code Online (Sandbox Code Playgroud)

不工作。请注意,如果imageView正在设置动画,或者动画是否已删除。

?????????? 下面的答案 ???????????????

在设置图像并更改动画UIImageView的背景之前,只需停止动画。

UIImageView* imageView = [UIImageView alloc] init];
//......do sth. like setFrame ...
imageView.images = [NSArray arrayWithObjects....]; // set the animation images array 
imageView.animationDuration = 1.0;
[imageView startAnimating];
//......do sth.
[imageView stopAnimating];        // **** do not forget this!!!!! ****
imageView.backgroundColor = [UIColor greenColor];
imageView.image = [UIImage imageName:@"angryBird"];
Run Code Online (Sandbox Code Playgroud)

同样在选择器方法中,当执行performSelector:withObject:afterDey:1.0s时,您也需要stopAnimating,然后设置Image或更改背景色。

iphone cocoa-touch objective-c uiimageview ios

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

GDB / LLDB在指定模块/共享库的所有功能处中断

在中lldb,我得到了help breakpoint set

       -a <address-expression> ( --address <address-expression> )
        Set the breakpoint at the specified address.  If the address maps uniquely to a particular binary, then the address will be converted to a "file" address, so that the
        breakpoint will track that binary+offset no matter where the binary eventually loads.  Alternately, if you also specify the module - with the -s option - then the
        address will be treated as a file address in that module, …
Run Code Online (Sandbox Code Playgroud)

debugging xcode gdb ios lldb

3
推荐指数
1
解决办法
1223
查看次数