Centos + nginx + WordPress
仕事でWordPressを入れる作業したのでメモ。
nginxのインストールは以前書いたので省略。
http://work.castleman-blog.com/entry/20110826/1314364283
1.yumで各種インストール
# yum install mysql-server php php-mysql php-mbstring php-fpm
2.MySQL設定
# /etc/rc.d/init.d/mysqld start # chkconfig mysqld on # mysql_secure_installation ← passwordだけn、それ以外Enter押してdefault # mysql -uroot -p mysql> create database wordpress; mysql> grant all privileges on wordpress.* to wordpress@localhost identified by 'wordpress'; mysql> flush privileges;
3.FPM設定
# vim /etc/php-fpm.d/www.conf user = nginx group = nginx # chkconfig php-fpm on # /etc/rc.d/init.d/php-fpm start
4.wordpress設定
# cd /var/www # curl -LO http://ja.wordpress.org/latest-ja.tar.gz # tar xvzf latest-ja.tar.gz # cp wordpress/wp-config-sample.php wordpress/wp-config.php # vim wordpress/wp-config.php define('DB_NAME', 'wordpress'); define('DB_USER', 'wordpress'); define('DB_PASSWORD', 'wordpress'); # chown -R nginx:nginx /var/www/wordpress
5.nginx設定
# vim /etc/nginx/nginx.conf root /var/www/wordpress; index index.php index.html; try_files $uri $uri/ /index.php?q=$uri&$args; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/wordpress$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; } # /etc/rc.d/init.d/nginx restart