Ubuntu 패키지에 포함된 apache2로 서버를 운영할 경우, a2enmod 명령으로 apache 모듈을 활성화 할 수 있다.
– ubuntu 패키지의 apache2를 설치할 경우 apache2 디렉토리로 이동하면 아래와 같이 mods-available 디렉토리와 mods-enabled 디렉토리가 있다.
1 2 3 4 5 |
root@localhost:~# cd /etc/apache2/ root@localhost:/etc/apache2# ls apache2.conf conf.d envvars httpd.conf mods-available mods-enabled ports.conf sites-available sites-enabled |
– mods-available 디렉토리에는 활성화 가능한 모듈들이 들어 있으며, mods-enabled 디렉토리에는 실제 활성화 된 모듈들이 symbolic link 가 생성되어 있다.
a2enmod 명령으로 모듈을 활성화 하면 mods-available 디렉토리에 있는 모듈들이 mods-enabled로 symbolic link가 생성된 것을 확인 할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
root@localhost:/etc/apache2# cd mods-available/ root@localhost:/etc/apache2/mods-available# ls actions.load authz_owner.load dir.conf log_forensic.load proxy_ftp.load alias.load authz_user.load dir.load mem_cache.conf proxy_http.load asis.load autoindex.load disk_cache.conf mem_cache.load rewrite.load auth_basic.load cache.load disk_cache.load mime.load setenvif.load auth_digest.load cern_meta.load dump_io.load mime_magic.conf sick-hack-to-update-modules authn_alias.load cgi.load env.load mime_magic.load speling.load authn_anon.load cgid.conf expires.load mod_python.load ssl.conf authn_dbd.load cgid.load ext_filter.load negotiation.load ssl.load authn_dbm.load charset_lite.load file_cache.load perl.load status.load authn_default.load dav.load filter.load php5.conf suexec.load authn_file.load dav_fs.conf headers.load php5.load unique_id.load authnz_ldap.load dav_fs.load ident.load proxy.conf userdir.conf authz_dbm.load dav_lock.load imagemap.load proxy.load userdir.load authz_default.load dbd.load include.load proxy_ajp.load usertrack.load authz_groupfile.load deflate.conf info.load proxy_balancer.load version.load authz_host.load deflate.load ldap.load proxy_connect.load vhost_alias.load root@localhost:/etc/apache2/mods-available# cd ../mods-enabled/ root@localhost:/etc/apache2/mods-enabled# ls -l total 0 lrwxrwxrwx 1 root root 28 2008-12-02 01:42 alias.load -> ../mods-available/alias.load lrwxrwxrwx 1 root root 33 2008-12-02 01:42 auth_basic.load -> ../mods-available/auth_basic.load lrwxrwxrwx 1 root root 33 2008-12-02 01:42 authn_file.load -> ../mods-available/authn_file.load lrwxrwxrwx 1 root root 36 2008-12-02 01:42 authz_default.load -> ../mods-available/authz_default.load lrwxrwxrwx 1 root root 38 2008-12-02 01:42 authz_groupfile.load -> ../mods-available/authz_groupfile.load lrwxrwxrwx 1 root root 33 2008-12-02 01:42 authz_host.load -> ../mods-available/authz_host.load lrwxrwxrwx 1 root root 33 2008-12-02 01:42 authz_user.load -> ../mods-available/authz_user.load lrwxrwxrwx 1 root root 32 2008-12-02 01:42 autoindex.load -> ../mods-available/autoindex.load lrwxrwxrwx 1 root root 26 2008-12-02 01:42 cgi.load -> ../mods-available/cgi.load lrwxrwxrwx 1 root root 26 2008-12-02 01:42 dir.conf -> ../mods-available/dir.conf lrwxrwxrwx 1 root root 26 2008-12-02 01:42 dir.load -> ../mods-available/dir.load lrwxrwxrwx 1 root root 26 2008-12-02 01:42 env.load -> ../mods-available/env.load lrwxrwxrwx 1 root root 27 2008-12-02 01:42 mime.load -> ../mods-available/mime.load lrwxrwxrwx 1 root root 33 2008-12-02 01:42 mod_python.load -> ../mods-available/mod_python.load lrwxrwxrwx 1 root root 34 2008-12-02 01:42 negotiation.load -> ../mods-available/negotiation.load lrwxrwxrwx 1 root root 27 2008-12-02 01:42 perl.load -> ../mods-available/perl.load lrwxrwxrwx 1 root root 27 2008-12-02 01:42 php5.conf -> ../mods-available/php5.conf lrwxrwxrwx 1 root root 27 2008-12-02 01:42 php5.load -> ../mods-available/php5.load lrwxrwxrwx 1 root root 30 2008-12-12 12:02 rewrite.load -> ../mods-available/rewrite.load lrwxrwxrwx 1 root root 31 2008-12-02 01:42 setenvif.load -> ../mods-available/setenvif.load lrwxrwxrwx 1 root root 29 2008-12-02 01:42 status.load -> ../mods-available/status.load root@localhost:/etc/apache2/mods-enabled# |
apache2 rewrite 모듈 활성화
- a2enmod 명령으로 rewrite 모듈을 활성화
1 2 3 4 |
root@localhost:/etc# a2enmod rewrite Module rewrite installed; run /etc/init.d/apache2 force-reload to enable. |
– a2enmod 를 실행 할 경우는 아래와 같이 /etc/apache2/mods-available/rewrite.load 파일이 /etc/apache2/mods-enabled/ 디렉토리로 링크가 생성된다.
1 2 3 4 |
root@localhost:/etc/apache2/mods-enabled# ls -l /etc/apache2/mods-enabled/rewrite.load lrwxrwxrwx 1 root root 30 Dec 13 12:02 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load |
– a2enmod 명령을 사용하지 않고 수동으로 링크를 생성해도 된다.
- /etc/apache2/apache2.conf 파일에 아래의 내용을 추가한다.
RewriteEngine On
1 2 3 |
RewriteEngine On |
다음과 같이 간단이 처리
sudo a2ensite site.kr
1 2 3 |
sudo a2ensite site.kr |
1 2 3 |
삭제: sudo a2dissite site.kr |