PHP Script to Find GeoIP info

If you have PHP GeoIP module installed, you can use following PHP script to find GeoIP info.

Enable PHP Error Reporting

To enable PHP error reporting in scripts, add

To avoid PHP scripts showing errors, add

See php

Amazon AWS Elastic Beanstalk Command Line Interface

To install Amazon AWS Elastic Beanstalk Command Line Interface (EB CLI), run

To create a project.

To create servers in AWS, run

It ask some question, once you done, it shows URL like following

In this cause, the URL http://serverok-dev.us-west-2.elasticbeanstalk.com/ can be used to access my application.

To deploy an application, create a file, commit to git.

In few minutes, you will be able to see the file on your Elastic Beanstalk application url

http://serverok-dev.us-west-2.elasticbeanstalk.com/test.php

When you are done with it, you can terminate the environment with command

It will show in AWS Console > Elastic Beanstalk with info “Waiting for EC2 instances to terminate.”

ISPConfig

Enable LetsEncrypt SSL in ISPConfig

Login to ISPConfig at

https://your-server-ip:8080

On main menu, click on “Sites”. It will show all available web sites on your server.

ISPConfig

Click on the domain on which you need LetsEncrypt SSL installed.

On Next page, click the check boxes “SSL” and “LetsEncrypt”.

ISPConfig LetsEncrypt Free SSL

Click “Save” button. In few minutes you will get SSL installed on your web site.

See LetsEncrypt

Install tmux on CentOS 6

tmux is a terminal emulator. It work like screen, but have more features.

CentOS 6 do not come with tmux, you need to enable rpmforge repository.

http://repoforge.org/use/

On CentOS 6 64 bit, run

Amazon Auto Scaling Protection

Prevent an EC2 Instance getting Terminated by AutoScale

You may need to update software on an instance in Amazon EC2 Auto Scaling Groups, when this happens make sure you enable “Scale In Protection” or your instance can get deleted by Auto Scaling group.

There is also an option for Standby mode. This option is also helpful for updating software on an instance. When instance is in Sandby mode, it won’t serve any requests. If its “Scale In Protection”, it will serve traffic, you will be able to debug any issues on this instance.

To enable protection, go to

EC2 Console > AUTO SCALING > Auto Scaling Groups

Select your Auto Scaling group.

Amazon Auto Scaling Protection

Click on instance you need to protect or set to standby. Then click on Actions, you have options to set the EC2 Instance in Standby mode or enable “Scale in Protection”

Delete Amazon S3 bucket

Delete Amazon S3 Bucket

To delete an Amazon S3 bucket, go to

Amazon Console > S3

Click on the bucket you need to delete. Then click on Delete button. You have option to empty the bucket if needed.

Delete Amazon S3 bucket

See Amazon S3

Amazon S3 permission

Make Amazon S3 Bucket public

To make an Amazon S3 bucket public, go to

Amazon Console > S3 > Bucket > Permission

Amazon S3 permission

Click on Permissions

Amazon S3 Bucket Policy

Click “Bucket policy”

Amazon S3 Policy editor

You get a blank editor. To make the bucket public, paste following code

Replace with your actual S3 Bucket name.

See Amazon S3