我正在尝试将所有子域重定向到我的主域,但到目前为止它不起作用。这是我的做法:
server {
listen [::]:80;
server_name *.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen [::]:443;
server_name example.com;
ssl on;
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
#enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#Disables all weak ciphers
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECD$
ssl_prefer_server_ciphers on;
root /var/www/html;
index index.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将S3和Cognito集成到我的iOS应用程序中,到目前为止还没有成功.我相信错误与我的Autah和Unauth用户的IAM策略有关.所以这是我的政策:
{
"Version": "2012-10-17",
"Statement":
[{
"Effect":"Allow",
"Action":"cognito-sync:*",
"Resource":["arn:aws:cognito-sync:us-east-1:XXXXXXXXXXXX:identitypool/${cognito-identity.amazonaws.com:aud}/identity/${cognito-identity.amazonaws.com:sub}/*"]
},
{
"Effect":"Allow",
"Action": "s3:*",
"Resource": ["arn:aws:s3:::my_bucket",
"arn:aws:s3:::my_bucket/*"]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我称之为S3的地方:
AWSS3GetObjectRequest *getObjectRequest = [[AWSS3GetObjectRequest alloc] init];
getObjectRequest.key = KEY;
getObjectRequest.bucket = BUCKET;
//default service has been configured previously
AWSS3 *s3 = [[AWSS3 new] initWithConfiguration:[AWSServiceManager defaultServiceManager].defaultServiceConfiguration];
[[s3 getObject:getObjectRequest] continueWithBlock:^id(BFTask *task) {
if(task.error)
{
NSLog(@"Error: %@",task.error);
}
else
{
NSLog(@"Got File");
NSData *data = [task.result body];
NSString *urlString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSURL *url = [[NSURL alloc] initWithString:urlString];
if ([[UIApplication …
Run Code Online (Sandbox Code Playgroud) 我正在使用AWS Cognito进行用户身份验证,我正在尝试测试未经身份验证的用户,但我从Cognito获得的只是一个空身份.以下代码位于viewDidLoad方法上:
AWSCognitoCredentialsProvider *credentialsProvider = [AWSCognitoCredentialsProvider
credentialsWithRegionType:AWSRegionUSEast1
accountId:@"XXXXXXXXXXXX"
identityPoolId:@"us-east-1:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
unauthRoleArn:@"arn:aws:iam::XXXXXXXXXXXX:role/Cognito_XXXXXXXXXUnauth_DefaultRole"
authRoleArn:@"arn:aws:iam::XXXXXXXXXXXX:role/Cognito_XXXXXXXXXAuth_DefaultRole"];
AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
[[credentialsProvider getIdentityId] continueWithSuccessBlock:^id(BFTask *task){
NSString* cognitoId = credentialsProvider.identityId;
NSLog(@"cognitoId: %@", cognitoId);
//[self launchCount];
return nil;
}];
Run Code Online (Sandbox Code Playgroud)
所以从上面的NSLog我得到:
cognitoId: (null)
Run Code Online (Sandbox Code Playgroud)
以下是授权和未授权用户的Cognito身份验证策略:
{
"Version": "2012-10-17",
"Statement":[{
"Effect":"Allow",
"Action":"cognito-sync:*",
"Resource":["arn:aws:cognito-sync:us-east-1:XXXXXXXXXXXX:identitypool/${cognito- identity.amazonaws.com:aud}/identity/${cognito-identity.amazonaws.com:sub}/*"]
}]
}
Run Code Online (Sandbox Code Playgroud)
任何想法可能是什么,或者我做错了什么?
我正在努力学习C,而且和很多人一样,我一直有点困难.无论如何,我做了一个递归函数来销毁我的链表,但是当我调试时,当我从函数返回时,列表的头部不应该是空的,所以我猜它是一些基本的误解指针.这是功能:
void destroy(struct node* n){
if(!n) return;
destroy(n->next);
free(n);
n = NULL; }
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我正在通过Python执行外部程序.我想知道什么是调用外部程序,最好的选择subprocess.Popen()
还是有subprocess.call()
.此外,我需要测量外部程序使用的经过时间,内存量和CPU.我听说过psutil
,但我真的不知道该选哪个.
我正在实施 Lode Runner 的一个版本(这个版本),但我不确定如何重现小兵合作以逼迫玩家的效果,可以使用 A* 来完成,还是有更好的方法?是否有更好的算法来实现仆从(例如群体)之间的协作,或者最好的解决方案是简单地为每个人单独应用一个算法?
我对在节点中更新某些文档的最佳实践感到困惑,例如,我不知道是否应该通过req.body更新多个字段(这会让我更容易):
//course is the document and Course is the model
util.updateDocument(course, Course, req.body);
Run Code Online (Sandbox Code Playgroud)
或者如果我应该创建多个post方法,每个方法都有一个文档字段来更新并从客户端连续请求它们:
app.put('/updatecourse/:field1',function(req, res){});
app.put('/updatecourse/:field2',function(req, res){});
app.put('/updatecourse/:field3',function(req, res){});
Run Code Online (Sandbox Code Playgroud)
目前我正在使用通过req.body接收文档的任何字段并更新它的函数,但是从我听到的这不是一个好的做法,加上方法不是异步的.有人可以向我解释这种情况的最佳做法是什么?
ios ×2
shell ×2
amazon-iam ×1
amazon-s3 ×1
c ×1
function ×1
game-ai ×1
linked-list ×1
macos ×1
mongoose ×1
nginx ×1
node.js ×1
path-finding ×1
psutil ×1
python ×1
redirect ×1
subprocess ×1