![](https://stat100.ameba.jp/blog/ucs/img/char/char2/173.gif)
まずはApacheから。
$ yum install httpd
$ vi /etc/httpd/conf/httpd.conf
$ vi /etc/httpd/conf/httpd.conf
以下のように変更。ドキュメントルートをeclipseのworkspaceにしています。当然外からアクセスできない環境です。
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
ServerName www.yukisku-workst.sknetsv.com:80
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/home/yukisku/workspace"
<Directory "/home/yukisku/workspace">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<Directory "/home/yukisku/workspace">
Options Includes ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
SetEnvIf Request_URI "default\.ida" no_log
SetEnvIf Request_URI "cmd\.exe" no_log
SetEnvIf Request_URI "root\.exe" no_log
SetEnvIf Request_URI "Admin\.dll" no_log
SetEnvIf Request_URI "NULL\.IDA" no_log
CustomLog logs/access_log combined env=!no_log
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
#AddType application/x-gzip .tgz
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
#AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#EnableMMAP off
EnableSendfile on
IncludeOptional conf.d/*.conf
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
ServerName www.yukisku-workst.sknetsv.com:80
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/home/yukisku/workspace"
<Directory "/home/yukisku/workspace">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<Directory "/home/yukisku/workspace">
Options Includes ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
SetEnvIf Request_URI "default\.ida" no_log
SetEnvIf Request_URI "cmd\.exe" no_log
SetEnvIf Request_URI "root\.exe" no_log
SetEnvIf Request_URI "Admin\.dll" no_log
SetEnvIf Request_URI "NULL\.IDA" no_log
CustomLog logs/access_log combined env=!no_log
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
#AddType application/x-gzip .tgz
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
#AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#EnableMMAP off
EnableSendfile on
IncludeOptional conf.d/*.conf
ロードするモジュールの設定。
$ vi /etc/httpd/conf.modules.d/00-proxy.conf
プロクシ関連は使用しないので、すべてコメントアウト(行頭に#を追記)
$ vi /etc/httpd/conf.modules.d/00-dav.conf
webdav関連は使用しないので、すべてコメントアウト(行頭に#を追記)
プロクシ関連は使用しないので、すべてコメントアウト(行頭に#を追記)
$ vi /etc/httpd/conf.modules.d/00-dav.conf
webdav関連は使用しないので、すべてコメントアウト(行頭に#を追記)
サービスの開始と自動起動設定。
$ systemctl start httpd
$ systemctl enable httpd
$ systemctl enable httpd
次はPostgreSQL。現時点ではyumで9.2が入るので、yumでインストールすることにした。
$ yum install postgresql postgresql-server postgresql-contrib postgresql-devel
$ passwd postgres
ユーザー postgres のパスワードを変更。
新しいパスワード:
新しいパスワードを再入力してください:
passwd: すべての認証トークンが正しく更新できました。
ユーザー postgres のパスワードを変更。
新しいパスワード:
新しいパスワードを再入力してください:
passwd: すべての認証トークンが正しく更新できました。
$ su - postgres
とりあえず初期化だけして終了。
-bash-4.2$ initdb
-bash-4.2$ exit
-bash-4.2$ exit
以降、以下のファイルで設定。
接続設定:/var/lib/pgsql/data/pg_hba.conf
環境設定:/var/lib/pgsql/data/postgresql.conf
環境設定:/var/lib/pgsql/data/postgresql.conf
サービス開始と自動起動設定。
$ systemctl start postgresql
$ systemctl enable postgresql
$ systemctl enable postgresql
つづけてphp。
$ yum install php php-mbstring php-pdo php-pgsql
$ vi /etc/php.ini
;; 出力バッファリング無効
output_buffering = Off
;; httpヘッダでPHPに関する情報を出力しない
expose_php = Off
;; ブラウザにエラーを表示しない(デフォルト)
display_errors = Off
;; エラーログを記録する
log_errors = On
;; エラーログの記録先
error_log = syslog
;; デフォルトの文字コードを指定
default_charset = “UTF-8″
;; 動的モジュールのロードしない(デフォルト)
enable_dl = Off
;; 外部ファイルを読み込まない
allow_url_fopen = Off
;; 外部のPHPを読み込まない(デフォルト)
allow_url_include = Off
;; セッションの処理を Cookie のみに限定 (デフォルト)
session.use_only_cookies = 1
;; セッションIDにMD5(128bit)でなくSHA-1(160bit)を利用する。
session.hash_function = 1
;; デフォルトの内部エンコーディングを設定
mbstring.language = Japanese
;; デフォルトの内部エンコーディングを設定
mbstring.internal_encoding = UTF-8
;; デフォルトのHTTP入力文字エンコーディングを設定
mbstring.http_input = auto
;; デフォルトのHTTP出力文字エンコーディングを設定
mbstring.http_output = UTF-8
;; HTTP入力エンコーディング変換を有効にする
mbstring.encoding_translation = On
;; デフォルトの文字エンコーディング検出順序を設定
mbstring.detect_order = auto
;; 代替文字のデフォルト値を設定
mbstring.substitute_character = none;
;; 拡張モジュールDir設定(728行目あたり)
extension_dir = "/usr/lib64/php/modules"
;; 拡張モジュール指定(860行目あたりに追記)
extension=pgsql.so
extension=mbstring.so
output_buffering = Off
;; httpヘッダでPHPに関する情報を出力しない
expose_php = Off
;; ブラウザにエラーを表示しない(デフォルト)
display_errors = Off
;; エラーログを記録する
log_errors = On
;; エラーログの記録先
error_log = syslog
;; デフォルトの文字コードを指定
default_charset = “UTF-8″
;; 動的モジュールのロードしない(デフォルト)
enable_dl = Off
;; 外部ファイルを読み込まない
allow_url_fopen = Off
;; 外部のPHPを読み込まない(デフォルト)
allow_url_include = Off
;; セッションの処理を Cookie のみに限定 (デフォルト)
session.use_only_cookies = 1
;; セッションIDにMD5(128bit)でなくSHA-1(160bit)を利用する。
session.hash_function = 1
;; デフォルトの内部エンコーディングを設定
mbstring.language = Japanese
;; デフォルトの内部エンコーディングを設定
mbstring.internal_encoding = UTF-8
;; デフォルトのHTTP入力文字エンコーディングを設定
mbstring.http_input = auto
;; デフォルトのHTTP出力文字エンコーディングを設定
mbstring.http_output = UTF-8
;; HTTP入力エンコーディング変換を有効にする
mbstring.encoding_translation = On
;; デフォルトの文字エンコーディング検出順序を設定
mbstring.detect_order = auto
;; 代替文字のデフォルト値を設定
mbstring.substitute_character = none;
;; 拡張モジュールDir設定(728行目あたり)
extension_dir = "/usr/lib64/php/modules"
;; 拡張モジュール指定(860行目あたりに追記)
extension=pgsql.so
extension=mbstring.so
phpを実行するディレクトリには、htaccessを設置し以下を記載。
AddType application/x-httpd-php .php .html
以下をindex.htmlとして保存し、pdo_pgsqlがenabledになっていることを確認。
<?php
phpinfo();
phpinfo();
![](https://stat.ameba.jp/user_images/20141225/23/yukisku/36/e3/p/t02200176_0800064113169762454.png?caw=800)
以上、構築手順でした。