JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

在CentOS 6.5上做Nginx+MariaDB+WordPress整合架設


又到了2013年的年尾了,趕在這個月結束前記錄一下換種環境架設WordPress的過程,感覺是有比傳統用Apache2和MySQL快許多(心理作用!?),如果有機會希望可以用這個環境來替換這個Blog,不過我看最近是無望了,所以廢話不多說,直接上實作吧:
1) 先準備一台CentOS6.5的環境(並設定好網路環境、Mirror與安裝EPEL)
#vi /etc/sysconfig/selinux
SELINUX=disabled
#setup -> Disable Firewall
#vi /etc/sysconfig/network-script/ifcfg-eth0 -> Setup the IP Configuration
#vi /etc/sysconfig/network -> Setup the GateWay
#vi/etc/resolv.conf -> Setup the DNS
#rpm -ivh http://mirror01.idc.hinet.net/EPEL/6Server/x86_64/epel-release-6-8.noarch.rpm

2) 透過YUM來安裝與設定Nginx(預設不啟動httpd以免搶Port)
#yum install nginx -y
#/etc/init.d/httpd stop
#chkconfig httpd off
#chkconfig nginx on

#vi /etc/nginx/nginx.conf
## number through lscpu
worker_processes 2;
#vi /etc/nginx/conf.d/default.conf
...
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
...
#/etc/init.d/nginx restart

3) 透過瀏覽器來Check網站服務

4) 透過YUM來安裝與設定MariaDB(事先把MySQL的Server作移除)
#yum remove mysql* mysql-server mysql-devel mysql-libs
#rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#yum --enablerepo=remi-test --disablerepo=remi install compat-mysql55
#vi /etc/yum.repos.d/mariadb.repo
## MariaDB 5.5 CentOS repository list - created 2013-06-06 07:53 UTC
## http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#yum list | grep -i mariadb
#yum update
#yum install MariaDB-devel MariaDB-client MariaDB-server -y
#/etc/init.d/mysql start
#/usr/bin/mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

5) 透過YUM安裝與設定PHP與php-fpm(PHP與MariaDB貌似也是用php-mysql做連線)
#yum install php php-common php-fpm php-mysql -y
#/etc/init.d/php-fpm start
#vi /etc/php-fpm.conf
#vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx
#/etc/init.d/php-fpm start
#vi /etc/php.ini
cgi.fix_pathinfo=0
#/etc/init.d/php-fpm restart

6) 建立testphp.php來Check各個Function與安裝php-mbstring
#vi /usr/share/nginx/html/testphp.php
phpinfo();
?>
#yum install php-mbstring
#/etc/init.d/php-fpm restart
#/etc/init.d/nginx restart

7) 下載Wordpress且在Nginx根目錄作解壓
#wget http://tw.wordpress.org/wordpress-3.8-zh_TW.tar.gz
#mv wordpress-3.8-zh_TW.tar.gz /usr/share/nginx/html/
#cd /usr/share/nginx/html/ && tar zxvf wordpress-3.8-zh_TW.tar.gz

8) 之後再透過瀏覽器作設定即可(請事先透過phpmyadmin或直接用mysql-client去設定DB Name,大功告成!)

◎、以上就是在CentOS 6.5用Nginx、MariaDB搭上WordPress的架設過程,至於上述的步驟大部分均參考這篇文章,至於細部Tune設定WordPress的部分就留給各位看倌們慢慢品嘗了,先到這,先預祝大家2014年新年快樂!

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro