Posted
Filed under 프로그래밍

location = /favicon.ico { 
  return 204;
  access_log    off;
  log_not_found off;
}
location = /robots.txt { 
  return 204;
  access_log    off;
  log_not_found off;
}


전부 따로 써줘야 한다!!!!!

2011/11/02 11:31 2011/11/02 11:31
Posted
Filed under 프로그래밍
현재 접속해 있는 서버의 AWS정보를 가지고 와야 하는 경우가 있다
아마존 메뉴얼이 잘되어있긴하지만 좀 복잡해서 찾아보기가 힘들다

여튼...

http://docs.amazonwebservices.com/AWSEC2/2007-03-01/DeveloperGuide/AESDG-chapter-instancedata.html


Request
http://169.254.169.254/latest/meta-data/

Response
ami-id
ami-launch-index
ami-manifest-path
instance-id
hostname
local-ipv4
public-keys/
reservation-id
security-groups

예) 현재 접속한 EC2의 instance id 가져오기
http://169.254.169.254/latest/meta-data/instance-id

2011/11/01 16:54 2011/11/01 16:54
Posted
Filed under 프로그래밍
AWS EC2 인스턴트중 라이센스비용이 없는 아마존 리눅스 t1.micro의 경우
메모리도 613메가 밖에 안되고 처음 띄우면 swap메모리 조차도 없다
이것저것 깔고 뭐할라고 하면 메모리가 부족하다고 나올수 있는데
아래와 같이 swap을 추가하는 방법으로 해결하자

터미널에서 아래와 같이 실행
128MB 만큼 스왑파일이 생긴다
SWAPFILE=/mnt/swapfile.swap
dd if=/dev/zero of=$SWAPFILE bs=1M count=128
mkswap $SWAPFILE
swapon $SWAPFILE


아래 쉘을 만들면 편하다
vi /etc/init.d/swapfile

#! /bin/sh
# chkconfig: - 92 92
#
# Some things that run always go here
# Carry out specific functions when asked to by the system

case "$1" in 
   start)
     echo "Starting swapfile "
     swapon /mnt/swapfile.swap
     ;;
  stop)
     echo "Stopping swapfile"
     swapoff /mnt/swapfile.swap
     ;;
  restart|reload|force-reload)
    echo "Restarting swapfile"
    swapoff /mnt/swapfile.swap
    swapon /mnt/swapfile.swap
    ;;
  *)
    echo "Usage: /etc/init.d/swapfile {start|stop}"
    exit 1
   ;;
esac
exit 0



아래처럼 시동시 올라올수 있게 지정해주고
ntsysv 에서 체크해주자
chkconfig --add swapfile
2011/10/25 19:16 2011/10/25 19:16
Posted
Filed under 장난감

사용자 삽입 이미지
내꺼~
트랙사스 써밋

2011/10/20 20:52 2011/10/20 20:52
Posted
Filed under 장난감

수캥이꺼.

사용자 삽입 이미지

2011/10/18 11:23 2011/10/18 11:23
Posted
Filed under 장난감
RC 전차 티거

사용자 삽입 이미지
2011/10/18 11:21 2011/10/18 11:21
Posted
Filed under 프로그래밍/PHP

아마존 S3 PHP 주요코드

$response = $s3->list_objects('bucket', array( 
    'prefix' => 'FD/',
 'max-keys' => 1000000
)); 
  
var_dump($response->isOK()); 
print_r($response->body);

하위에 있는 모든 파일을 표시
max-keys는 몇개를 화면에 뿌릴건지를 표시 default 는 1000이다

$response = $s3->delete_all_objects('bucket','/FD\/000000000000/');

정규식을 이용한 삭제
위의 예제는 지정 디렉토리 하위까지 몽땅 삭제

$response = $s3->delete_object('bucket', 'FD/1.jpg');

한개만 삭제

$response = $s3->copy_object(array('bucket' => 'bucket','filename' =>'1.jpg'),array('bucket' => 'bucket','filename' => 'FD/2.jpg'));  

모모에서 모모로 복사

  $s3->batch()->create_object('bucket','FD/2.jpg', array(
   'fileUpload' => './3.jpg',
   'acl' => AmazonS3::ACL_PUBLIC,
  ));
  $file_upload_response = $s3->batch()->send();

파일을 S3에 전송
acl 권한을 줘야 외부에서 파일에 접근 할수 있다.

2011/10/18 11:01 2011/10/18 11:01
Posted
Filed under 프로그래밍

ssh 관련 명령 실행시 but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! 이 화면에 떠도 사용에 문제가 있는건 아니니 걱정마삼

2011/10/14 16:29 2011/10/14 16:29
Posted
Filed under 프로그래밍
pem 인증서를 아마존에서 다운받는다.
pem인증서에 퍼미션 0600 을 준다.

아래와 같이 접속하면 된다.

ssh -i xx.pem root@xxx.xxx.amazonaws.com

응용하면 scp도 아래처럼 가능하다

scp -i xx.pem a.jpg root@xxx.xxx.amazonaws.com:/home/xxxx


2011/10/12 14:58 2011/10/12 14:58
Posted
Filed under 프로그래밍
# 사용 방법
[ code ] [ /code ] 사이에( " [ "와 " code ", " code "와 " ] " 사이에 띄워쓰기 사용 않함 ) 출력할 코드를 넣어주면 자동으로 신택스 하이라이트가 적용됩니다. 기본값 [ code ] 는 C++코드를 신택스 하이라이트로 출력하며 [ code CShap ], [ code Java ], [ code lua ] 등 해당 언어에 대한 식별자를 지정하여 신택스 하이라이트를 적용시킬 수 있습니다.

언어 식별자
ActionScript3 as3, actionscript3
Bash/shell bash, shell
ColdFusion cf, coldfusion
C# c-sharp, csharp
C++ cpp, c
CSS css
Delphi delphi, pas, pascal
Diff diff, patch
Erlang erl, erlang
Groovy groovy
JavaScript js, jscript, javascript
Java java
JavaFX jfx, javafx
Perl perl, pl
PHP php
Plain Text plain, text
PowerShell ps, powershell
Python py, python
Ruby rails, ror, ruby
Scala scala
SQL sql
Visual Basic vb, vbnet
XML xml, xhtml, xslt, html, xhtml
2011/10/08 12:40 2011/10/08 12:40