PostgreSQL,PHP,Apache¤ÎRPM¤ÏÁ´¤Æºï½ü¤·¤Æ¤ª¤¤Þ¤¹
¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤¹¤ë¾ì¹ç¤Ï¥Ð¥Ã¥¯¥¢¥Ã¥×¤ò¼è¤Ã¤Æ»ß¤á¤Æ¤ª¤¤Þ¤·¤ç¤¦
postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ®
# /usr/sbin/useradd -d /usr/local/pgsql postgres # chmod 755 /usr/local/pgsql
ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ®
# mkdir /usr/local/src/postgresql-8.1.3 # chown postgres /usr/local/src/postgresql-8.1.3
¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/
¾ï¤ËºÇ¿·¥Ð¡¼¥¸¥ç¥ó¤ò³Îǧ¤·¤Þ¤·¤ç¤¦
ÄÌ¿®¤ò°Å¹æ²½¤¹¤ë¾ì¹ç¤Ï ./configure --with-openssl ¤È¤¹¤ë
# su postgres $ tar xvzf postgresql-8.1.3.tar.gz $ cd postgresql-8.1.3 $ ./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-8.1.3/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
MPM¤Ïworker¤â¤·¤¯¤Ïperchild¤À¤ÈPHP¤¬°ÂÄêÆ°ºî¤·¤Ê¤¤¤é¤·¤¤
»²¹Í
SSL¤ò͸ú¤Ë¤¹¤ë¾ì¹ç¤Ï --enable-ssl
# tar xvzf httpd-2.0.55.tar.gz # cd httpd-2.0.55 # ./configure --with-mpm=prefork --enable-rewrite # make # make install
Apache¤Î¥Ð¡¼¥¸¥ç¥ó¤Ê¤É¤òɽ¼¨¤µ¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ
ServerSignature Off ServerTokens Prod
# 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
# vi /etc/logrotate.d/apache
/usr/local/apache2/logs/*_log { rotate 4 compress # ZIP°µ½Ì¤¹¤ë¾ì¹ç 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
PHP¤á¤â¤â»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤
Amazon ECS¤Ê¤É¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏSimpleXML´Ø¿ô¤ò͸ú¤Ë¤·¤Æ¤ª¤¯
--enable-simplexml
cURL¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏÀè¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
RPM¤ÇÆþ¤Ã¤Æ¤¤¤ì¤ÐOK
--with-curl
MySQL¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï
--with-mysql
# tar xvzf php-5.1.2.tar.gz # cd php-5.1.2 # ./configure --with-pgsql --with-apxs2=/usr/local/apache2/bin/apxs \ --enable-zend-multibyte --enable-mbstring --with-gd \ --with-zlib-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr \ --with-freetype-dir=/usr --with-ttf --enable-gd-native-ttf \ --enable-gd-jis-conv --enable-sockets --enable-simplexml --with-curl \ --with-mysql
# cp /usr/local/src/php-5.1.2/php.ini-dist /usr/local/lib/php.ini
;; ½ÐÎϥХåե¡¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë output_buffering = On ;; mb_output_handler¤Ë¤è¤ë½ÐÎÏÊÑ´¹¤ò͸ú¤Ë¤¹¤ë output_handler = mb_output_handler ;; HTTP¥Ø¥Ã¥À charset ¤òÀßÄê default_charset = Shift_JIS ;;ÆüËܸì¼çÂΤǻÈÍÑ mbstring.language = Japanese ;; ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òEUC-JP¤ËÀßÄê mbstring.internal_encoding = EUC-JP ;; HTTPÆþÎÏ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹¤òauto¤ËÀßÄê mbstring.http_input = auto ;; SJIS¤ËÊÑ´¹ mbstring.http_output = SJIS mbstring.encoding_translation = On mbstring.detect_order = auto ;; ̵¸ú¤Êʸ»ú¤ò½ÐÎϤ·¤Ê¤¤ mbstring.substitute_character = none; mbstring.func_overload = 0
# make # make install
AddType application/x-httpd-php .php
¤òÄɲä·¤ÆApacheºÆµ¯Æ°