小编Mah*_*bub的帖子

Codeigniter的nginx重写规则无法正常工作

我第一次尝试在MAMP中使用nginx服务器而不是用于Codeigniter的apache服务器.我将我的apache htaccess重写规则转换为nginx重写规则.但它显示的是我文件中的index.php文件代码而不是我的网站.这是我的apache htaccess规则,

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

这是我的nginx配置文件,

http {
include                  mime.types;
default_type             text/html;
gzip                     on;
gzip_types               text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

sendfile                 on;

server {
    listen               80 default_server;

    # MAMP DOCUMENT_ROOT !! Don't remove this line !!
    root "C:/MAMP/htdocs/aia_inventory/";

    access_log  C:/MAMP/logs/nginx_access.log;

    error_log  C:/MAMP/logs/nginx_error.log;

    index index.html index.htm index.php;
    #autoindex on;
    #server_name localhost;
    location ~/ {
        #root C:/MAMP/htdocs/aia_inventory/;
        #index index.html …
Run Code Online (Sandbox Code Playgroud)

php .htaccess mamp nginx codeigniter-3

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

400 Bad Request 响应:请求中必须指定 KeyConditionExpression 参数

我正在尝试在我的 php 应用程序中使用 amazon dynamodb。我已正确设置凭据。现在,我尝试将数据从 Amazon DynamoDB 获取到我的应用程序。但它在查询行给了我一个例外。

完整的异常错误是

无法查询:在“ https://dynamodb.my-region.amazonaws.com ”上执行“查询”时出错;AWS HTTP 错误:客户端错误:POST https://dynamodb.my-region.amazonaws.com导致400 Bad Request响应:{"__type":"com.amazon.coral.validate#ValidationException","message":"KeyConditions 或 KeyConditionExpression(已截断...)ValidationException(客户端):必须在请求中指定 KeyConditions 或 KeyConditionExpression 参数。 - {"__type":"com.amazon.coral.validate#ValidationException","message":"必须在请求中指定 KeyConditions 或 KeyConditionExpression 参数。" }

这是我的代码,

$sdk = new Aws\Sdk([
        'region' => 'my region',
        'version' => 'latest',
        'credentials' => [
            'key' => 'my key',
            'secret' => 'my secret key'
        ],
        'DynamoDb' => [
            'region' => 'my region',
        ],
    ]);

    $dynamodb = $sdk->createDynamoDb();
    $marshaler = new Marshaler();

    $tableName = 'My Table Name'; …
Run Code Online (Sandbox Code Playgroud)

php amazon-s3 amazon-web-services amazon-dynamodb aws-sdk

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

名称 'conn' 未定义:NameError

我想将我的 aws iot mqtt 消息存储到我的 postgresql 中。为此,我已经将本地 posrtgresql 连接到亚马逊 RDS 实例。现在,我需要在 amazon lambda calculus 之间创建一个连接,然后将数据发送到 postgresql 数据库。但是每当我测试我的 lambda 演算时,它都会给我“名称'conn'未定义:NameError”错误。这是我在 aws lambda 中的 python 代码。我还在我的项目中包含了 psycopg2 库。

import sys
import logging
import rds_config
import psycopg2
#rds settings
rds_host  = "myhost"
name = "username"
password = "username_password"
db_name = "dbname"

logger = logging.getLogger()
logger.setLevel(logging.INFO)

try:
    conn = psycopg2.connect(host=rds_host, user=name, password=password, 
           dbname=db_name, connect_timeout=5)
except:
     logger.error("ERROR: Unexpected error: Could not connect to postgreSQL 
          instance.")

logger.info("SUCCESS: Connection to RDS postgreSQL instance succeeded")
def handler(event, context): …
Run Code Online (Sandbox Code Playgroud)

postgresql amazon-web-services python-3.x aws-lambda

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