PostgreSQL8.0¤Î²òÀâ
Apache2.2¤Î²òÀâ
¥Ð¡¼¥¸¥ç¥ó8.1.4, 8.0.8, 7.4.13, 7.3.15°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤Ï¥Þ¥ë¥Á¥Ð¥¤¥È½èÍý¤ËSQL¥¤¥ó¥¸¥§¥¯¥·¥ç¥ó¤ÎÀȼåÀ¤¬¤¢¤ê¤Þ¤¹¡£
¾ÜºÙ(SRA OSS)
¾ÜºÙ(ITpro)
PostgreSQL,PHP,Apache¤ÎRPM¤ÏÁ´¤Æºï½ü¤·¤Æ¤ª¤¤Þ¤¹
¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤¹¤ë¾ì¹ç¤Ï¥Ð¥Ã¥¯¥¢¥Ã¥×¤ò¼è¤Ã¤Æ»ß¤á¤Æ¤ª¤¤Þ¤·¤ç¤¦
postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ®
# /usr/sbin/useradd -d /usr/local/pgsql postgres # chmod 755 /usr/local/pgsql
ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ®
# mkdir /usr/local/src/postgresql-9.4.4 # chown postgres /usr/local/src/postgresql-9.4.4
¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/
¾ï¤ËºÇ¿·¥Ð¡¼¥¸¥ç¥ó¤ò³Îǧ¤·¤Þ¤·¤ç¤¦
ÄÌ¿®¤ò°Å¹æ²½¤¹¤ë¾ì¹ç¤Ï ./configure --with-openssl ¤È¤¹¤ë
# yum install readline-devel zlib-devel # su postgres $ tar xvzf postgresql-9.4.4.tar.gz $ cd postgresql-9.4.4 $ ./configure $ gmake $ gmake check $ gmake install
$ cd $ cd data $ openssl req -new -text -out server.req Generating a 1024 bit RSA private key ...++++++ .....++++++ writing new private key to 'privkey.pem' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:JP State or Province Name (full name) [Berkshire]:Shiga Locality Name (eg, city) [Newbury]:Otsu Organization Name (eg, company) [My Company Ltd]:Self Organizational Unit Name (eg, section) []:Engineer Common Name (eg, your name or your server's hostname) []:example.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
¥Ñ¥¹¥Õ¥ì¡¼¥º¤Îºï½ü
$ openssl rsa -in privkey.pem -out server.key $ rm -f privkey.pem
¼«¸Ê½ð̾
$ openssl req -x509 -in server.req -text -key server.key -out server.crt $ chmod og-rwx server.key
pg_hba.conf ¤Ëhostssl¤òµ½Ò
postgresql.conf ¤Îssl¤òon¤Ë¤¹¤ë
¥¯¥é¥¤¥¢¥ó¥È¦¤Ë¤âPostgreSQL¤ò --with-openssl ÉÕ¤¤Ç¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
µ¯Æ°¤¹¤ëɬÍפÏ̵¤·
postgres¤ÈPostgreSQL¤ò»ÈÍѤ¹¤ë¥æ¡¼¥¶¡¼Á´¤Æ¤Î.bashrc¤Ë°Ê²¼¤òÄɲÃ
PATH="$PATH":/usr/local/pgsql/bin export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
ÀßÄê¤ÎÈ¿±Ç
$ source ~/.bashrc
¥Ç¡¼¥¿¥Ù¡¼¥¹½é´ü²½
$ initdb --encoding=EUC_JP --no-locale
°ì¹ÔÄɲÃ
# vi /etc/ld.so.conf /usr/local/pgsql/lib # /sbin/ldconfig
# cp /usr/local/src/postgresql-9.4.4/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql # chmod 755 /etc/rc.d/init.d/postgresql # /sbin/chkconfig --add postgresql # /etc/rc.d/init.d/postgresql start
$ vi /usr/local/pgsql/data/postgresql.conf redirect_stderr = on log_filename = '%m-%d.log' log_truncate_on_rotation = on log_min_error_statement = error log_line_prefix = '<%t %u %d %p>'
postgresql-8.3.0°Ê¹ß
logging_collector = on log_filename = '%m-%d.log' log_truncate_on_rotation = on log_min_error_statement = error log_line_prefix = '<%t %u %d %p>'
postgresql-8.1¤«¤é¤Ï¼«Æ°¤ÇVACUUM¤¬¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤ËÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿
postgresql-8.3.0°Ê¹ß¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç͸ú¤Ë¤Ê¤Ã¤¿
$ vi /usr/local/pgsql/data/postgresql.conf stats_row_level = on autovacuum = on
postgresql-8.3.0°Ê¹ß
track_counts = on autovacuum = on
°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤ÏÆ°ºî¤·¤Æ¤¤¤¿¤Î¤Ë¡¢9¤Ë¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤·¤¿¤éÆ°¤«¤Ê¤¤¡¦¡¦¡¦¤È¤¤¤¦¾ì¹ç¤Ï°Ê²¼¤òÊѹ¹¤·¤ÆºÆµ¯Æ°¤¹¤ì¤Ð¹¬¤»¤Ë¤Ê¤ì¤ë¤«¤â¡£
standard_conforming_strings = off default_transaction_deferrable = on
¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏÉÔ½½Ê¬¤Ê¤Î¤Ç¤³¤Á¤é¤ò»²¹Í¤Ë¹ç¤ï¤»¤Æ¤ä¤Ã¤Æ¤ª¤³¤¦
PostgreSQL¤Î¥Á¥å¡¼¥Ë¥ó¥°
MPM¤Ïworker¤â¤·¤¯¤Ïperchild¤À¤ÈPHP¤¬°ÂÄêÆ°ºî¤·¤Ê¤¤¤é¤·¤¤
»²¹Í
SSL¤ò͸ú¤Ë¤¹¤ë¾ì¹ç¤Ï --enable-ssl
»²¹Í
DAV¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï --enable-dav
# tar xvzf httpd-2.2.19.tar.gz # cd httpd-2.2.19 # ./configure \ --with-mpm=prefork \ --enable-rewrite \ --enable-so \ --with-included-apr # make # make install
apache2.2.4¤¢¤¿¤ê¤«¤é¤Ï
¡Öconfigure: error: Cannot use an external APR-util with the bundled APR¡×
¤È¥¨¥é¡¼¤¬½Ð¤ë¤è¤¦¤Ê¤Î¤Ç --with-included-apr ¤òÄɲ乤ë
apache2.4¤¢¤¿¤ê¤«¤é¤Ïapr¤¬Ê̤ˤʤ俤ߤ¿¤¤¤Ê¤Î¤Ç¡¢ÊÌÅÓÆþ¤ì¤ë
PCRE¤È¤ä¤é¤âÍפëÌÏÍÍ
http://apr.apache.org/
http://pcre.org/
pcre2-10.10.tar.gz ¤À¤È¤¦¤Þ¤¯¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿
# tar xvzf apr-1.5.2.tar.gz # cd apr-1.5.2 # ./configure --prefix=/usr/local/apr # make # make install # cd .. # tar xvzf apr-util-1.5.4.tar.gz # cd apr-util-1.5.4 # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr # make # make install # cd .. # tar xvzf pcre-8.37.tar.gz # cd pcre-8.37 # ./configure --prefix=/usr/local/pcre # make # make install # cd .. # tar xvzf httpd-2.4.12.tar.gz # cd httpd-2.4.12 # ./configure \ --with-mpm=prefork \ --enable-rewrite \ --enable-so \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --with-pcre=/usr/local/pcre # make # make install
nobody¸¢¸Â¤Ë¤Ê¤ë¤è¤¦¤ËÊѹ¹
ÆäËÍýͳ¤Ï̵¤·¡£ÀΤ«¤é¤Î¸Ä¿ÍŪ¤Ê̾»Ä
<IfModule !mpm_netware_module> User nobody Group nobody </IfModule>
Apache2.0·Ï¤Î¾ì¹ç
vi /usr/local/apache2/conf/httpd.conf
ServerTokens Prod ServerSignature Off TraceEnable Off
Apache2.2·Ï¤Î¾ì¹ç
Apache2.2·Ï¤«¤éÌÜŪÊ̤κ٤«¤¤ÀßÄê¤ÏÊÌ¥Õ¥¡¥¤¥ë¤ËʬΥ¤µ¤ì¤Æ¤¤¤ë¡£
apache2/conf/extra/ Æâ¤Ë httpd-xxxxxxx.conf ¤Î·Á¼°¤Ç¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¡£
¤³¤ì¤é¤òÆɤ߹þ¤à¤¿¤á¤Ë¤Ï httpd.conf Æâ¤Ç³ºÅö²Õ½ê¤Î¥³¥á¥ó¥È¤ò³°¤¹É¬Íפ¬¤¢¤ë
º£²óÀßÄꤹ¤ë¹àÌܤ¬¤¢¤ë¤Î¤Ï httpd-default.conf
vi /usr/local/apache2/conf/httpd.conf Include conf/extra/httpd-default.conf
httpd.conf ¤ÇÆɤ߹þ¤Þ¤»¤¿¥Õ¥¡¥¤¥ë¤òÊÔ½¸
vi /usr/local/apache2/conf/extra/httpd-default.conf
ServerTokens Prod ServerSignature Off TraceEnable Off
¡ÖTraceEnable¡×¤ÏºÇ½é½ñ¤¤¤Æ¤Ê¤¤¤«¤â
¤½¤Î¾ì¹ç¡ÖServerSignature¡×¤Î²¼¤Ë¤Ç¤âÄɲ䷤Ȥ±¤Ð¤¤¤¤¤À¤í¤¦
Apache2.4·Ï¤Î¾ì¹ç
vi /usr/local/apache2/conf/httpd.conf
LoadModule cgi_module modules/mod_cgi.so LoadModule userdir_module modules/mod_userdir.so LoadModule rewrite_module modules/mod_rewrite.so
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd # chmod 755 /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd
°Ê²¼¤òÄɲÃ
#!/bin/sh # chkconfig: - 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # pidfile: /usr/local/apache2/logs/httpd.pid # config: /usr/local/apache2/conf/httpd.conf
# /sbin/chkconfig --add httpd # /etc/rc.d/init.d/httpd start
¥í¥°¤òZIP°µ½Ì¤¹¤ë¾ì¹ç compress
# vi /etc/logrotate.d/apache
/usr/local/apache2/logs/*_log { rotate 4 compress weekly sharedscripts postrotate /usr/local/apache2/bin/apachectl restart endscript }
# /usr/sbin/logrotate -f /etc/logrotate.d/apache
¥³¥Þ¥ó¥É¤Ë¤Æ /usr/local/apache2/logs Æâ¤Ë access_log.1 error_log.1 ¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤ì¤ÐOK
http://jp.php.net/downloads.php
PHP¤á¤â¤â»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤
Amazon ECS¤Ê¤É¤òÍøÍѤ¹¤ë¾ì¹ç¤Ï͸ú¤Ë¤·¤Æ¤ª¤¯
--enable-simplexml
cURL¤ÏÀè¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
RPM¤ÇÆþ¤Ã¤Æ¤¤¤ì¤ÐOK
--with-curl
fopen('https://example.com/index.html');
¤Ê¤É¤È¤·¤¿¤¤¾ì¹ç¤Ï»ØÄ꤬ɬÍ×
--with-openssl
MySQL¤ÏÀè¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
¥½¡¼¥¹¤«¤é¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ÏMySQL5.0¥¤¥ó¥¹¥È¡¼¥ë¤ò»²¾È
--with-mysql
--enable-pdo=shared¥Ç¡¼¥¿¥Ù¡¼¥¹¸ÇͤÎPDO¥É¥é¥¤¥Ð¤ò»ÈÍѤ¹¤ëɬÍפ¬¤¢¤Î¤Ç¡¢RDBMS¤Î¼ïÎà¤Ë¹ç¤ï¤»¤Æ²¼µ¤òÄɲÃ
--with-pdo-pgsql=shared
--with-pdo-sqlite=shared
--with-pdo-mysql=shared
5.3.5¤¯¤é¤¤¤«¤é --with-ttf ¥ª¥×¥·¥ç¥ó¤Ï̵¸ú
5.4.0¤¯¤é¤¤¤«¤é --enable-zend-multibyte ¥ª¥×¥·¥ç¥ó¤Ï̵¸ú
# yum install libxml2-devel libjpeg-devel libpng-devel freetype-devel curl curl-devel openssl-devel # tar xvzf php-5.6.10.tar.gz # cd php-5.6.10 # ./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --enable-zend-multibyte \ --enable-mbstring \ --enable-mbregex \ --with-zlib \ --with-gd \ --with-zlib-dir=/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-freetype-dir=/usr \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --enable-sockets \ --enable-simplexml \ --with-curl \ --with-pgsql \ --with-mysql=/usr/local/mysql \ --with-sqlite=shared \ --enable-pdo=shared \ --with-pdo-pgsql=shared \ --with-pdo-mysql=shared \ --with-pdo-sqlite=shared \ --with-ttf # make # make install
--enable-soap
--enable-ftp
# cp /usr/local/src/php-5.1.4/php.ini-dist /usr/local/lib/php.ini # cp /usr/local/src/php-5.6.10/php.ini-production /usr/local/lib/php.ini
;; ½ÐÎϥХåե¡¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë output_buffering = On ; 5.1.4 output_buffering = 4096 ; 5.3.2 ;; mb_output_handler¤Ë¤è¤ë½ÐÎÏÊÑ´¹¤ò͸ú¤Ë¤¹¤ë output_handler = mb_output_handler ;; ¥Ø¥Ã¥À¤Ëɽ¼¨¤µ¤ì¤ë X-Powered-By: PHP/x.x.x ¤òÈóɽ¼¨¤Ë¤¹¤ë expose_php = Off magic_quotes_gpc = Off ; 5.4.0¤Çºï½ü ;; HTTP¥Ø¥Ã¥À charset ¤òÀßÄê default_charset = Shift_JIS ;;ÆüËܸì¼çÂΤǻÈÍÑ mbstring.language = Japanese ;; ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òEUC-JP¤ËÀßÄê mbstring.internal_encoding = EUC-JP ;; ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤·¤Ê¤¤ mbstring.http_input = pass ;; ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤·¤Ê¤¤ mbstring.http_output = pass ;; ¼«Æ°¥¨¥ó¥³¡¼¥É ;; ʸ»ú²½¤±¤Î¸¶°ø¤Ë¤Ê¤ë¤Î¤Ç¡¢¼«ÎϤǥ¨¥ó¥³¡¼¥É mbstring.encoding_translation = Off mbstring.detect_order = auto ;; ̵¸ú¤Êʸ»ú¤ò½ÐÎϤ·¤Ê¤¤ mbstring.substitute_character = none; mbstring.func_overload = 0 ;; ÊÑ¿ô¤Î¥Ñ¡¼¥¹¤Î½çÈÖ¤òÀßÄê variables_order = "EGPCS" ;; $_REQUEST ÇÛÎó¤ËÅÐÏ¿¤¹¤ë½ç½ø¡ÊPHP5.3.0¤«¤éƳÆþ¡Ë ;; »ØÄꤷ¤Ê¤¤¤È$_REQUEST¤Çcookie¤¬¼èÆÀ¤Ç¤¤Ê¤¤¤Î¤ÇÃí°Õ request_order = "GPC" ;; 5.5.1¤¢¤¿¤ê¤«¤é¤Ï error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED error_reporting = E_ALL & ~E_NOTICE log_errors = Off ;; 5.3.0°Ê¹ß ¥á¡¼¥ë¤Î¥Ø¥Ã¥À¤Ë X-PHP-Originating-Script ¤¬Äɲ䵤ì¤ë ;; ¥Ø¥Ã¥À¤¬¤¯¤º¤ì¤ë¤Î¤ÇOff mail.add_x_header = Off ;; 5.1.0°Ê¹ßdate, strtotime¤Ê¤É¤ò»È¤¦¤ÈE_NOTICE¤äE_WARNING¤¬È¯À¸¤¹¤ë¤Î¤ÇÀßÄꤷ¤Æ¤ª¤¯ date.timezone = Asia/Tokyo ; 4.3.0¤«¤éÄɲÃ5.3.0°Ê¹ß¤Çdefault1¤Ë¤Ê¤Ã¤¿¤Î¤Ç¡¢¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×»þ·ÈÂÓÅÅÏäΥ»¥Ã¥·¥ç¥ó´ÉÍý¤Ç¥Ï¥Þ¤ë²ÄǽÀ¤¢¤ê session.use_only_cookies = 1 or 0 ; Zend_Session¤ò»ÈÍѤ¹¤ë¤Ê¤é¤Ð¥³¥á¥ó¥È¤ò¤Ï¤º¤·¤Æ¤ª¤¯¤ÈµÈ session.save_path = "/tmp"
AddType application/x-httpd-php .php
¤òÄɲä·¤ÆApacheºÆµ¯Æ°