Apache: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


== Options ==
== Options ==
=== -S ===
=== -S ===
현재 서비스 중인 웹사이트 목록을 표시한다.
현재 서비스 중인 웹사이트 목록을 표시한다.
Line 66: Line 65:
  version_module (shared)
  version_module (shared)
</pre>
</pre>
== Modules ==
=== mod_rewrite ===
페이지를 Redirect 할 때 사용하는 모듈이다.
<pre>
#With mod_rewrite
RewriteEngine on
RewriteRule  "^/docs/(.+)"  "http://new.example.com/docs/$1"  [R,L]
#With RedirectMatch
RedirectMatch "^/docs/(.*)" "http://new.example.com/docs/$1"
#With Redirect
Redirect "/docs/" "http://new.example.com/docs/"
</pre>
* https://httpd.apache.org/docs/2.4/rewrite/remapping.html - Redirecting and Remapping with mod_rewrite


== Rerfeneces ==
== Rerfeneces ==
<references />
<references />


[[category:linux]]
[[category:system]]

Latest revision as of 09:21, 1 August 2016

Overview

apache 사용법 설명

Options

-S

현재 서비스 중인 웹사이트 목록을 표시한다.

-S     Show the settings as parsed from the config file (currently only shows the virtualhost settings).

Example

~# apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:

*:8080                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)
  port 8080 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)

*:8081                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)
  port 8081 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)

*:80                   is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
  port 80 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
  port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com.vhost:7)

Syntax OK

-M

현재 로드된 모듈 목록을 표시한다.

Example

$ ./apachectl -M |sort
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 core_module (static)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 headers_module (shared)
 http_module (static)
 jk_module (shared)
Loaded Modules:
 log_config_module (shared)
 mime_module (shared)
 mpm_event_module (static)
 reqtimeout_module (shared)
 setenvif_module (shared)
 so_module (static)
 status_module (shared)
 unixd_module (shared)
 version_module (shared)

Modules

mod_rewrite

페이지를 Redirect 할 때 사용하는 모듈이다.

#With mod_rewrite
RewriteEngine on
RewriteRule   "^/docs/(.+)"  "http://new.example.com/docs/$1"  [R,L]

#With RedirectMatch
RedirectMatch "^/docs/(.*)" "http://new.example.com/docs/$1"

#With Redirect
Redirect "/docs/" "http://new.example.com/docs/"

Rerfeneces

<references />