728x90
300x250

[Linux] Ubuntu 9.04 (배포리눅스 공용) - 네트워크 설정

우분투 9.04 서버(Ubuntu 9.04 Server)에서 확인하였습니다.
하지만, 대부분 OS에서 공통으로 활용 가능합니다.

윈도우 7의 경우에 들자면 아래 그림처럼 네트워크를 관리할 수 있습니다.

Linux에서의 네트워크 설정은 '/etc/network', '/etc/resolv.conf' 에서 대부분 처리합니다.


1. 정적ip, 유동ip 설정

network 폴더로 이동하면 (cd /etc/network)
interface라는 파일이 있습니다.
sudo vim interface

파일의 전문은 다음과 같습니다.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

auto eth0
iface eth0 inet dhcp
auto eth0

진하게 되어 있는 부분은 DHCP를 의미합니다. (그리고 초기 설치 시 기본 값이기도 합니다.)


- 고정 ip 설정 방법

iface eth0 inet static
address 192.168.100.10
netmask 255.255.255.0
gateway 192.168.100.254


2. Nameserver 설정

네임서버(Nameserver) 설정이라고도 하고 DNS서버 설정이라고 불리는 부분에 대해 살펴보겠습니다.
위에서 정리해놓은 것처럼, DNS는 /etc/resolv.conf에서 설정할 수 있습니다.

sudo vim /etc/resolv.conf
nameserver 168.126.63.1(자신이 사용하는 회사의 DNS를 입력하시거나 본인의 서버 DNS를 입력하시면 됩니다.


3. Network 재시작

sudo /etc/init.d/networking restart
반응형
728x90
300x250

[Linux] Centos 5.3(32bit), Ubuntu 9.04(64bit) - Apache 2.x + PHP 5.3 + MySQL, 라이브러리 설치하기

태스트 환경1 :

운영체제 : Centos 5.3(32bit)
CPU : AMD Athlon 64 x2 3600
RAM : 2GB

태스트 환경2 :
운영체제 : Ubuntu 9.04(64bit)
CPU : Atom 230 x2
RAM : 1GB


필수 사용 라이브러리 :


Libmcrypt(암호화 라이브러리)


다운로드를 받을만한 위치로 이동합니다.


다운로드 받기 :
http://www.mysql.com (MYSQL 홈페이지)
ftp://ftp.neowiz.com/pub/apache/httpd/httpd-2.2.11.tar.gz
ftp://ftp.neowiz.com/pub/languages/php/

미러링 서버 제공 : 네오위즈

다운로드 받기


wget 주소 (MySQL 5.x 버전) 다운로드
tar xvfz mysql-5.1.version.tar.gz                  (압축 풀기)

wget ftp://ftp.neowiz.com/pub/apache/httpd/httpd-2.2.11.tar.gz      (Apache 2.2.11) 다운로드
tar xvzf httpd-2.2.11.tar.gz                       (압축 풀기)

wget ftp://ftp.neowiz.com/pub/languages/php/     (Php-5.2.10) 다운로드
tar xvzf php-5.2.10.tar.gz                        (압축 풀기)



 


 


 


 


 


 


 
(기타 라이브러리 재 연동)
/usr/local/php/bin/pear upgrade-all
/usr/local/php/bin/pear install DB File Mail Mail_Mime
/usr/local/php/bin/pear install MDB2 MDB2_Driver_mysql MDB2_Driver_mysqli
/usr/local/php/bin/pear install HTTP_Request XML_RPC


최종 수정 : 2009년 9월 22일

반응형
728x90
300x250

[Linux] Apache 2.x에서 Host를 Redirect하여 연결하기

호스트를 원하는 방향으로 다시 향할 수 있도록 하는 방법에 대해서 몇가지 소개하고자 합니다.

1. 첫페이지(index)를 통해 방향을 재탐색하는 방법입니다.

<META HTTP-EQUIV="Refresh" Content="0; URL=http://www.company.com/dir1/">

<html>
<head>
<META HTTP-EQUIV="Refresh" Content="3; URL=http://www.company.com/dir1/">
</head>
<body>
This page will forward to http://www.company.com/dir1/ in three seconds.
<p>
Please update your links.
</body>
</html>


2. cgi를 이용한 재 탐색 방법입니다. (mod-cgi)

설정 파일 명 : httpd.conf

ScriptAlias / /var/www/cgi-bin/redirect-script/

설정 파일 명 : /var/www/cgi-bin/redirect-script
#!/usr/bin/perl

print "Status: 301 Moved\r\n" .
      "Location: http://www.new-domain.com/\r\n" .
      "\r\n";

또는

#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
print redirect('http://www.new-domain.com');

3. PHP를 이용한 방법 입니다.

<?php
header("Location: http://www.new-domain.com/");
?>

4. 자바스크립트를 이용한 방법입니다.

<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script
//<![CDATA[
window.location.href="http://www.new-domain.com/"    
//]]> End script hiding -->
</script>
</head>
</html>

5. Apache 서버 모듈을 이용하는 방법입니다.(mod_rewrite)
RewriteEngine On
RewriteRule /.* http://www.new-domain.com/ [R]

6. Apache 서버 모듈을 이용하는 방법입니다.(mod_alias)

설정 파일명 : httpd.conf
1. Redirect Domain:
Redirect / http://www.new-domain.com/
또는
Redirect permanent / http://www.new-domain.com/

2. Redirect Page:
Redirect /web-page.html http://www.new-domain.com/destination-web-page.html

참고 : 재탐색(Redirect)을 지시하기 전에 앞서 Alias(별명)과 ScriptAlias를 지시해야 합니다.
다른 "재탐색(Redirect) 옵션들 포함 : 
(임시 오류 번호 : 302는 기본값 - 임시적으로 재탐색되는 상태)
'오류 번호 303'이라고도 불리고 See other라는 메시지로 보여지는 것은 다른 것과 대체하던지, '오류 번호 404' 를 영구히 제거해야만 합니다.

예제) vhost를 이용한 redirect(재탐색) 기법
<VirtualHost XXX.XXX.XXX.XXX>
ServerName directtolinux.com
ServerAlias www.directtolinux.com
ServerAlias direct-to-linux.com
ServerAlias www.direct-to-linux.com
ServerAlias digitalpenguins.com
ServerAlias www.digitalpenguins.com
Redirect permanent / http://www.yolinux.com/
</VirtualHost>

7. Apache 서버에서 .htaccess 파일을 이용하여 재탐색하기.

vi나 vim에디터를 이용하여 사용자 계정 public_html(사용자 홈페이지 디렉토리 - 설정하신 폴더에 넣어주세요)에 .htaccess를 수정하거나 만듭니다.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^yolinux.com
RewriteRule ^(.*)$ http://www.yolinux.com/$1 [R=permanent,L]

SP. Apache 서버에서 httpd.conf와 .htaccess 파일을 이용한 재탐색 기법.

설정 파일명(위치) : /etc/httpd/conf/httpd.conf
(apache서버를 설치한 폴더 위치를 찾아서 하시기 바랍니다.)

아래의 예제는 현재 .htaccess를 사용할 수 없는 상태를 뜻하고 있습니다.
<Directory />
         AllowOverride None
</Directory>

AllowOverride All로 바꾸시면 .htaccess를 사용하실 수 있습니다.

설정 파일명(위치) : .htaccess(/home/domain/public_html/.htaccess)에 위치합니다.
/home/domain/public_html/.htaccess 에 생성하신 도메인이 아래와 같이 보이는 것과 같이 향하게 됩니다.

특정 도메인으로 이동

Redirect 301 /  http://www.new-domain.com/

특정 파일로 이동

Redirect 301 /old-page-1.html  http://www.newdomain.com/new-page-1.html
Redirect 301 /old-page-2.html  http://www.newdomain.com/new-page-2.html

반응형

+ Recent posts