小编ax1*_*man的帖子

在EC2 Tomcat服务器上安装SSL

我正在尝试使用Ubuntu和Tomcat 7.0.52在AWS EC2实例上运行CA证书/ SSL.浏览器无法连接.以下是我通过的步骤:

keytool -genkey -alias mydomain -keyalg RSA -keystore mydomain.keystore -keysize 2048
<fill out information>

keytool -certreq -keyalg RSA -alias mydomain -file certreq.csr -keystore ../mydomain.keystore
Run Code Online (Sandbox Code Playgroud)

将csr提交给ssls.com/Geotrust,然后收回:bundle.crt www.mydomain.net.crt

将证书导入密钥库:

keytool -import -trustcacerts -alias root -keystore ../mydomain.keystore -file bundle.crt
keytool -import -alias mydomain -keystore ../mydomain.keystore -file www.mydomain.net.crt
Run Code Online (Sandbox Code Playgroud)

接下来,更新$ TOMCAT_HOME/config/server.xml:

<Connector port="8080" protocol="HTTP/1.1"
       connectionTimeout="20000"
       redirectPort="443" />
<Connector port="8443" SSLEnabled="true"
       maxThreads="150" scheme="https" secure="true"
       keystoreFile="/home/ubuntu/mydomain.keystore" 
       keystorePass="xxxxxxx"
       clientAuth="false" sslProtocol="TLS" />
Run Code Online (Sandbox Code Playgroud)

并重新启动tomcat.

具有安全组的EC2实例设置为允许端口80和443.

ipables更改为重定向80-> 8080和443-> 8443:

sudo iptables -t nat -n -L PREROUTING --line-numbers
Chain …
Run Code Online (Sandbox Code Playgroud)

ssl tomcat amazon-ec2

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

通过面部检测进行裁剪

我正在修改Apple SquareCam示例人脸检测应用程序,以便在写入相机胶卷之前裁剪出面部,而不是在脸部周围绘制红色正方形.我正在使用相同的CGRect进行裁剪,就像用于绘制红色正方形一样.然而,行为是不同的.在纵向模式下,如果面部位于屏幕的水平中心,则会按预期裁剪面部(红色正方形所在的位置).如果脸部偏向左侧或右侧,则作物似乎总是从屏幕中间拍摄,而不是红色正方形.

这是苹果原始代码:

- (CGImageRef)newSquareOverlayedImageForFeatures:(NSArray *)features 
                                            inCGImage:(CGImageRef)backgroundImage 
                                      withOrientation:(UIDeviceOrientation)orientation 
                                          frontFacing:(BOOL)isFrontFacing
{
    CGImageRef returnImage = NULL;
    CGRect backgroundImageRect = CGRectMake(0., 0., CGImageGetWidth(backgroundImage), CGImageGetHeight(backgroundImage));
    CGContextRef bitmapContext = CreateCGBitmapContextForSize(backgroundImageRect.size);
    CGContextClearRect(bitmapContext, backgroundImageRect);
    CGContextDrawImage(bitmapContext, backgroundImageRect, backgroundImage);
    CGFloat rotationDegrees = 0.;

    switch (orientation) {
        case UIDeviceOrientationPortrait:
            rotationDegrees = -90.;
            break;
        case UIDeviceOrientationPortraitUpsideDown:
            rotationDegrees = 90.;
            break;
        case UIDeviceOrientationLandscapeLeft:
            if (isFrontFacing) rotationDegrees = 180.;
            else rotationDegrees = 0.;
            break;
        case UIDeviceOrientationLandscapeRight:
            if (isFrontFacing) rotationDegrees = 0.;
            else rotationDegrees = 180.;
            break;
        case UIDeviceOrientationFaceUp:
        case UIDeviceOrientationFaceDown:
        default:
            break; // …
Run Code Online (Sandbox Code Playgroud)

ios

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

标签 统计

amazon-ec2 ×1

ios ×1

ssl ×1

tomcat ×1