公開日:2009/6/1 0:00:00

CetOS 5

Zend Server on CentOS 5 Httpd の設定変更

設定

CentOSに付属しているhttpdを使用しているので、基本的なところは変わりません。
とはいえ、あちこちのマニュアルに飛ばすのもなんなので、ここでも同じような説明をします。

設定関連ファイルは/etc/httpd配下にあります。
PORXY関連は使用する予定が無いのでそのあたりの設定を変更します。

行なう事は、auth系、WebDAV、proxyのモジュール切り離し、サーバー名や管理者のアドレス。cgiも使わないのでその設定の削除などを行います。

[root@zendserver ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
[root@zendserver ~]# vi /etc/httpd/conf/httpd.conf
*** /etc/httpd/conf/httpd.conf.2009-05-08       2009-05-08 hh:ii:ss.000000000 +0900
--- /etc/httpd/conf/httpd.conf  2009-05-08 hh:ii:ss.000000000 +0900
***************
*** 145,165 ****
        # Example:
        # LoadModule foo_module modules/mod_foo.so
        #
!       LoadModule auth_basic_module modules/mod_auth_basic.so
!       LoadModule auth_digest_module modules/mod_auth_digest.so
!       LoadModule authn_file_module modules/mod_authn_file.so
!       LoadModule authn_alias_module modules/mod_authn_alias.so
!       LoadModule authn_anon_module modules/mod_authn_anon.so
!       LoadModule authn_dbm_module modules/mod_authn_dbm.so
!       LoadModule authn_default_module modules/mod_authn_default.so
        LoadModule authz_host_module modules/mod_authz_host.so
        LoadModule authz_user_module modules/mod_authz_user.so
        LoadModule authz_owner_module modules/mod_authz_owner.so
        LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
!       LoadModule authz_dbm_module modules/mod_authz_dbm.so
        LoadModule authz_default_module modules/mod_authz_default.so
!       LoadModule ldap_module modules/mod_ldap.so
!       LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
        LoadModule include_module modules/mod_include.so
        LoadModule log_config_module modules/mod_log_config.so
        LoadModule logio_module modules/mod_logio.so
--- 145,165 ----
        # Example:
        # LoadModule foo_module modules/mod_foo.so
        #
!       #LoadModule auth_basic_module modules/mod_auth_basic.so
!       #LoadModule auth_digest_module modules/mod_auth_digest.so
!       #LoadModule authn_file_module modules/mod_authn_file.so
!       #LoadModule authn_alias_module modules/mod_authn_alias.so
!       #LoadModule authn_anon_module modules/mod_authn_anon.so
!       #LoadModule authn_dbm_module modules/mod_authn_dbm.so
!       #LoadModule authn_default_module modules/mod_authn_default.so
        LoadModule authz_host_module modules/mod_authz_host.so
        LoadModule authz_user_module modules/mod_authz_user.so
        LoadModule authz_owner_module modules/mod_authz_owner.so
        LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
!       #LoadModule authz_dbm_module modules/mod_authz_dbm.so
        LoadModule authz_default_module modules/mod_authz_default.so
!       #LoadModule ldap_module modules/mod_ldap.so
!       #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
        LoadModule include_module modules/mod_include.so
        LoadModule log_config_module modules/mod_log_config.so
        LoadModule logio_module modules/mod_logio.so
***************
*** 172,182 ****
        LoadModule usertrack_module modules/mod_usertrack.so
        LoadModule setenvif_module modules/mod_setenvif.so
        LoadModule mime_module modules/mod_mime.so
!       LoadModule dav_module modules/mod_dav.so
        LoadModule status_module modules/mod_status.so
        LoadModule autoindex_module modules/mod_autoindex.so
        LoadModule info_module modules/mod_info.so
!       LoadModule dav_fs_module modules/mod_dav_fs.so
        LoadModule vhost_alias_module modules/mod_vhost_alias.so
        LoadModule negotiation_module modules/mod_negotiation.so
        LoadModule dir_module modules/mod_dir.so
--- 172,182 ----
        LoadModule usertrack_module modules/mod_usertrack.so
        LoadModule setenvif_module modules/mod_setenvif.so
        LoadModule mime_module modules/mod_mime.so
!       #LoadModule dav_module modules/mod_dav.so
        LoadModule status_module modules/mod_status.so
        LoadModule autoindex_module modules/mod_autoindex.so
        LoadModule info_module modules/mod_info.so
!       #LoadModule dav_fs_module modules/mod_dav_fs.so
        LoadModule vhost_alias_module modules/mod_vhost_alias.so
        LoadModule negotiation_module modules/mod_negotiation.so
        LoadModule dir_module modules/mod_dir.so
***************
*** 185,197 ****
        LoadModule userdir_module modules/mod_userdir.so
        LoadModule alias_module modules/mod_alias.so
        LoadModule rewrite_module modules/mod_rewrite.so
!       LoadModule proxy_module modules/mod_proxy.so
!       LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
!       LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
!       LoadModule proxy_http_module modules/mod_proxy_http.so
!       LoadModule proxy_connect_module modules/mod_proxy_connect.so
        LoadModule cache_module modules/mod_cache.so
!       LoadModule suexec_module modules/mod_suexec.so
        LoadModule disk_cache_module modules/mod_disk_cache.so
        LoadModule file_cache_module modules/mod_file_cache.so
        LoadModule mem_cache_module modules/mod_mem_cache.so
--- 185,197 ----
        LoadModule userdir_module modules/mod_userdir.so
        LoadModule alias_module modules/mod_alias.so
        LoadModule rewrite_module modules/mod_rewrite.so
!       #LoadModule proxy_module modules/mod_proxy.so
!       #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
!       #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
!       #LoadModule proxy_http_module modules/mod_proxy_http.so
!       #LoadModule proxy_connect_module modules/mod_proxy_connect.so
        LoadModule cache_module modules/mod_cache.so
!       #LoadModule suexec_module modules/mod_suexec.so
        LoadModule disk_cache_module modules/mod_disk_cache.so
        LoadModule file_cache_module modules/mod_file_cache.so
        LoadModule mem_cache_module modules/mod_mem_cache.so
***************
*** 248,254 ****
        # e-mailed.  This address appears on some server-generated pages, such
        # as error documents.  e.g. admin@your-domain.com
        #
!       ServerAdmin root@localhost

        #
        # ServerName gives the name and port that the server uses to identify itself.
--- 248,254 ----
        # e-mailed.  This address appears on some server-generated pages, such
        # as error documents.  e.g. admin@your-domain.com
        #
!       ServerAdmin rokubou@sixwish.jp

        #
        # ServerName gives the name and port that the server uses to identify itself.
***************
*** 262,268 ****
        # You will have to access it by its address anyway, and this will make
        # redirections work in a sensible way.
        #
!       #ServerName www.example.com:80

        #
        # UseCanonicalName: Determines how Apache constructs self-referencing
--- 262,268 ----
        # You will have to access it by its address anyway, and this will make
        # redirections work in a sensible way.
        #
!       ServerName zend.sixwish.jp:80

        #
        # UseCanonicalName: Determines how Apache constructs self-referencing
***************
*** 271,277 ****
        # by the client.  When set "On", Apache will use the value of the
        # ServerName directive.
        #
!       UseCanonicalName Off

        #
        # DocumentRoot: The directory out of which you will serve your
--- 271,277 ----
        # by the client.  When set "On", Apache will use the value of the
        # ServerName directive.
        #
!       UseCanonicalName On

        #
        # DocumentRoot: The directory out of which you will serve your
***************
*** 561,578 ****
        # The same rules about trailing "/" apply to ScriptAlias directives as to
        # Alias.
        #
!       ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

        #
        # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
        # CGI directory exists, if you have that configured.
        #
!       <Directory "/var/www/cgi-bin">
!           AllowOverride None
!           Options None
!           Order allow,deny
!           Allow from all
!       </Directory>

        #
        # Redirect allows you to tell clients about documents which used to exist in
--- 561,578 ----
        # The same rules about trailing "/" apply to ScriptAlias directives as to
        # Alias.
        #
!       #ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

        #
        # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
        # CGI directory exists, if you have that configured.
        #
!       #<Directory "/var/www/cgi-bin">
!       #    AllowOverride None
!       #    Options None
!       #    Order allow,deny
!       #    Allow from all
!       #</Directory>

        #
        # Redirect allows you to tell clients about documents which used to exist in
***************
*** 728,734 ****
        # Just list the languages in decreasing order of preference. We have
        # more or less alphabetized them here. You probably want to change this.
        #
!       LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

        #
        # ForceLanguagePriority allows you to serve a result page rather than
--- 728,734 ----
        # Just list the languages in decreasing order of preference. We have
        # more or less alphabetized them here. You probably want to change this.
        #
!       LanguagePriority ja en ca cs da de el eo es et fr he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

        #
        # ForceLanguagePriority allows you to serve a result page rather than
[root@zendserver ~]# 

続いて、Proxyのオプション設定ファイルを修正します。

[root@zendserver ~]# cp /etc/httpd/conf.d/proxy_ajp.conf /etc/httpd/conf.d/proxy_ajp.conf.org
[root@zendserver ~]# vi /etc/httpd/conf.d/proxy_ajp.conf
*** /etc/httpd/conf.d/proxy_ajp.conf.2009-05-08 2009-05-08 hh:ii:ss.000000000 +0900
--- /etc/httpd/conf.d/proxy_ajp.conf 2009-05-08 hh:ii:ss.000000000 +0900
***************
*** 1,5 ****

!       LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

        #
        # When loaded, the mod_proxy_ajp module adds support for
--- 1,5 ----

!       #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

        #
        # When loaded, the mod_proxy_ajp module adds support for
[root@zendserver ~]# 

変更できたら、設定ファイルをチェック、httpdを再起動します。

[root@zendserver ~]# service httpd configtest
Syntax OK
[root@zendserver ~]# service zend-server restart-apache
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]
[root@zendserver ~]# 

httpdの設定はここまで。
次回は、php.iniの変更の説明。