반응형

출처: http://webdir.tistory.com/196

 

우분투는 일반적인 리눅스 배포판들과 다른 구조를 하고 있습니다. 데비안 계열의 특징인듯 싶습니다.

설정 디렉토리 구조

/etc/apache2

설정파일 루트위치로, 설정파일들이 이 디렉토리 밑에 위치하고 있다.

/etc/apache2/apache2.conf

기본 설정파일로, 다른 배포판에서 httpd.conf를 기본 설정파일로 사용하고 있는데 우분투에서는 apache2.conf를 사용한다.

/etc/apache2/conf.d

고급설정 파일로, 다른 배포판에서 httpd.conf 파일 하나에 설정되어 있던 문자셋과 에러메시지, 보안과 관련된 설정등을 따로 따로 분리하여 conf.d 디렉토리밑에서 설정하고 있다. 또한 사용자가 설치하게 되는 Apache와 관련된 애플리케이션들의 설정파일들도 위치하게 된다.

/etc/apache2/envvars

apache2ctl 환경설정 파일이다.

/etc/apache2/httpd.conf

사용자의 특정 설정 파일로, 역사적으로 httpd.conf 가 기본설정 파일이였는데 지금은 빈파일이다. 사용자가 특정 설정을 부여해서 사용할 수 잇다.

/etc/apache2/magic

파일의 시작값(magic number) 데이터베이스. 이 값에 기반해 전송하는 파일의 MIME Type을 결정한다. 가급적 수정하지 말 것.

/etc/apache2/mods-available

사용가능한 Apache 모듈을 불러오는 곳이다.

/etc/apache2/mods-enabled

위의 /etc/apache2/mods-available 의 모듈중에 사용할 모듈을 심볼릭 링크로 추가하여 실제 동작하게 만든다.

/etc/apache2/ports.conf

Apache 서버의 서비스 포트 설정으로 http의 기본값 80 과 https의 기본값 443, 가상호스트의 포트들을 설정할 수 있다.

/etc/apache2/sites-available

서버에서 운영할 사이트의 설정파일이다.

/etc/apache2/sites-enabled

위의 /etc/apache2/sites-available에서 설정한 파일을 심볼릭 링크로 추가하여 실제 운영에 사용할 설정파일들이다.

기본 설정

1. 기본 사이트 설정 사항 ( /etc/apache2/sites-available/default )

apache2 의 기본설정은 가상호스트 친화적이다. 기본적으로 VirtualHost 지시자에 의해 하나의 가상호스트가 설정되어 있고 하나의 사이트만을 운영할 계획이라면 이 가상호스트 설정이 기본적인 웹사이트가 된다.

/etc/apache2/sites-available/default 파일을 수정하여 사용하면 된다.

ServerAdmin 의 메일주소를 원하는 것으로 수정하고 다른 여러 다른 가상호스트에서 설정하지 않을 경우 대표메일 주소로 이용된다.

ServerName이 지정되어 있지 않다. 이는 다른 가상호스트의 ServerName과 매치되지 않는 모든 요청에 대하여 응답하게 된다. 이를 원하지 않는다면 ServerName 에 구입한 도메인을 추가한다.

ServerAlias도 기본적으로 지정되어 있지 않지만 www를 호스트명으로 이용하는 경우가 많으니 이를 추가해도 된다.

DocumentRoot 값은 /var/www 로 지정되어 잇는데 원한다면 이를 수정하여 사용할 수 있다.

<Directory> 지사자에 Option 항목에 Indexes 가 설정되어 있는데 이를 제거해서 파일리스트들이 출력되지 않게 할 수 있다.

<Directory /home/MyID/www/uzuro.com>

Option -Indexes FollowSymLinks MultiViews

2. 새로운 가상호스트 추가법

우선 default 파일을 복사해 원하는 파일명(사이트명)으로 변경한다. 새로운 사이트의 디렉토리를 생성하고 복사한 파일의 DocumentRoot의 경로를 설정한다.

a2ensite 유틸리티를 사용하여 추가한다.

sudo a2ensite mynewsite
sudo service apache2 restart

3. DirectoryIndex 설정

/etc/apache2/mods-available/dir.conf 에서 설정할 수 있으면 기본적으로 index.html, index.cgi, index.pl, index.php, index.xhtml, index.htm 이 설정되어 있다. 필요하다면 더 추가하면 된다.

위 파일들이 요청한 디렉토리에 없다면 <Directory> 지시자의 Option 값으로 Indexes가 설정되어 있을 경우 파일이 리스팅된다.

4. ErrorDocument 설정

/etc/apache2/conf.d/localized-error-pages 에서 설정할 수 있다.

5. Log 설정

Apache의 기본 로그 파일은 /var/log/apache2/ 디렉토리에 access.log, error.log, other_vhosts_access.log 로 존재한다. 가상호스트 설정에서 ErrorLog 지시자나 CustomLog를 따로 설정하지 않는다면 위에 언급한 파일들에 로그가 저장되고 만약 가상호스트에서 설정사항을 주석처리하거나 삭제한다면 other_vhosts_access.log 파일에 생성된다.

여러개의 사이트를 운영할 계획이라면 각각의 홈디렉토리에 logs 디렉토리를 생성하여 그곳에 위치하는 방법을 많이 사용한다.

6. Apache 에러

서비스를 재시작할때마다 에러메시지가 함께 나올텐데 기본으로 설정된 사이트의 ServerName이 존재하지 않아서이다. 이는 /etc/apache2/apach2.conf에 ServerName localhost와 같이 추가하면 된다.

7. 새로운 모듈 추가

우분투는 기본적으로 동적으로 모듈을 불러오도록 컴파일되어 있다. <IfModule> 블럭으로 둘러쌓아 특정한 모듈에 대한 지시를 할 수 있고 /etc/apache2/mods-enabled 에 등록하여 이를 사용할 수 있다.

/etc/apache2/mods-available 디렉토리에 존재하지 않는 모듈들은 apt-get등으로 설치한다.

sudo a2enmod ssl
sudo service apache2 restart

사용하지 않을 모듈은 sudo a2dismod ssl과 같이 사용하고 apache 서비스 재시작한다.

8. 리눅스 계정의 사용자들이 각각 홈디렉토리에서 웹사이트를 운영할때 설정

/home/UserID/public_html의 구조를 생성한다(이때 폴더 소유자는 그계정의 사용자ID임에 유의).

mkdir public_html 

유저 디렉토리 모듈 활성화

사용자들이 http://서버도메인(IP)/~UserID 로 접근이 가능하게 된다.

sudo a2enmod userdir.conf
sudo a2enmod userdir.load
sudo service apache2 restart

sudo vi /etc/apache2/mods-available/userdir.conf의 설정내용을 알맞게 변경

php의 모듈 사용자 디렉토리에 활성화

php 모듈의 기본 설정이 기본적으로 /home/*/public_html 상에서는 사용불가로 되어 있다.

sudo vi /etc/apache2/mod-available/php5.conf

<IfModule mod_userdir.c> 부분부터 끝나는 블록까지 주석처리한다.

8. HTTPS 설정

The mod_ssl module adds an important feature to the Apache2 server - the ability to encrypt communications. Thus, when your browser is communicating using SSL, the https:// prefix is used at the beginning of the Uniform Resource Locator (URL) in the browser navigation bar.

The mod_ssl module is available in apache2-common package. Execute the following command from a terminal prompt to enable the mod_sslmodule:

sudo a2enmod ssl

There is a default HTTPS configuration file in /etc/apache2/sites-available/default-ssl. In order for Apache2 to provide HTTPS, a certificateand key file are also needed. The default HTTPS configuration will use a certificate and key generated by the ssl-cert package. They are good for testing, but the auto-generated certificate and key should be replaced by a certificate specific to the site or server. For information on generating a key and obtaining a certificate see Certificates

To configure Apache2 for HTTPS, enter the following:

sudo a2ensite default-ssl

The directories /etc/ssl/certs and /etc/ssl/private are the default locations. If you install the certificate and key in another directory make sure to change SSLCertificateFile and SSLCertificateKeyFile appropriately.

With Apache2 now configured for HTTPS, restart the service to enable the new settings:

sudo service apache2 restart

Depending on how you obtained your certificate you may need to enter a passphrase when Apache2 starts.

You can access the secure server pages by typing https://your_hostname/url/ in your browser address bar.

Sharing Write Permission

For more than one user to be able to write to the same directory it will be necessary to grant write permission to a group they share in common. The following example grants shared write permission to /var/www to the group "webmasters".

sudo chgrp -R webmasters /var/www
sudo find /var/www -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www -type f -exec chmod g=rws  "{}" \;

If access must be granted to more than one group per directory, enable Access Control Lists (ACLs).


참고 : https://help.ubuntu.com/12.04/serverguide/httpd.html

반응형
반응형

출처: http://simplelife.pe.kr/tc/286

 

전에 Activx 를 웹에 올려놨을때 나왔던 문제였는데
링크로 cab 파일을 클릭하면 파일 다운로드가 되어야 하는데
웹에 그냥 text파일인양 열릴때가 있다

그럴때는 아파치 설정 폴더에 보면
mime.types 파일이 있다
이 파일에 보면 아래와 같은 줄일 있을거다
없다면
새로 항목을 만들면 만들면 된다.

application/octet-stream        bin dms lha lzh exe class so dll dmg



위에 웹에 그냥 화면이 풀리는 확장자를 등록하고
아파치를 재시작하면
링크 클릭시에 파일다운로드 받는 창이 뜨는걸 볼수가 있을것이다

반응형
반응형

출처: http://1004lucifer.blogspot.kr/2015/03/jsp-jsp-web-linux-tail-f-log.html

 

Web 에서 Linux/Unix 의 'tail -f logfile' 과 같이 보려고 인터넷을 찾아보다 마음에 드는게 없어서 직접 만들게 되었다.

Server 에서 tail 명령어를 사용할 때 grep 을 많이 사용해서 해당 기능도 추가했다.


모습은 다음과 같다.



사용방법
1. tail -f {} 부분에 실시간으로 확인 할 로그파일을 선택
2. grep {} 부분에 문자열 입력 시 해당 문자열이 매칭되는 경우에만 출력
3. grep -v {} 부분에 문자열 입력 시 해당 문자열이 매칭되는 경우에는 출력 제외
(grep 에 넣을 문자열은 정규표현식 지원된다.)




Source
https://github.com/1004lucifer/JSP_tail

 

 

tail.jsp

 

반응형
반응형

출처:http://plustag.tistory.com/4

 

프론트엔드(Frond-end)는 사용자나 혹은 다른 프로그램과의 인터페이스를 말한다.

GUI같은 것들이 프론트엔드이다.

반대로 백엔드(Back-end)는 시스템의 구축, 내부로직, 데이터베이스설계, 데이터의 처리 등을 담당하게 된다.

프로그램을 만들때 프론트엔드와 백엔드를 나누어서 만드는 경우가 있는데 이러한 경우

프로그램의 외관을 바꿀 때는 프론트엔드만 변경시키면된다. 우리가 프로그램을 쓰다 외관이 지겨워서

다른 스킨을 갈아치우는 것과 마찬가지로..

프론트엔드를 바꾼다고해서 백엔드가 변경되진 않는다.

반대로 핵심기능에 중요한 오류가발생되어 수정한다고 했을 때 그 프로그램의 외관이 바뀌진 않는다.

혹은 서버의 백엔드를 수정했다고 해서 클라이언트의 요청이 바뀌지는 않을 것이다.

프로그램을 프론트엔드와 백엔드로 나누어서 개발하면 이러한 장점이 있다.

 

 

[텀즈]

클라이언트/서버 컴퓨팅 모델과 비교한다면, 프론트엔드는 클라이언트로, 백엔드는 서버로 이해할 수도 있을 것이다.

반응형

+ Recent posts