安装wordpress前的准备

环境:centos 6.9 64位;

(一)安装MySQL服务

  • 在命令行中输入以下命令来完成安装
yum install mysql-server
  • 查看MySQL-server服务的状态
service mysqld status
  • 开启MySQL-server服务
service mysqld start
  • 对MySQL-server进行配置
#输入命令: mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, 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): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
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 MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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] y
 ... Success!

By default, MySQL 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 MySQL
installation should now be secure.

Thanks for using MySQL!
  • 测试mysql
mysql -u root -p

使用上述命令后按回车输入上一步设置的密码,可以进入到MySQL数据库。安装MySQL完成

(二)安装PHP

yum install php-fpm php-mysql
  • 配置/etc/php.ini
  1. 修改cgi.fix_pathinfo=0
  2. 若不修改,则php会将用户输入的网址尽可能匹配到正确的地址;修改为0,则只有输入正确才显示

(三)配置nginx

1.在nginx.conf中添加如下:

server{
                listen 80;
                server_name blog.isdevil.com;
                location /{
                        root /usr/local/nginx/html;
                        index index.php index.html index.htm;
                }
                error_page 404  /404.html;
                location = /404.html {
                        root /usr/local/nginx/html;
                }
                #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
                location ~ \.php$ {
                        root                    /usr/local/nginx/html;
                        fastcgi_pass    127.0.0.1:9999;
                        fastcgi_index   index.php;
                        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include                 fastcgi_params;
                }
        }

2.修改/etc/php-fpm.d/www.conf文件

user = nginx
group = nginx
listen=127.0.0.1:9999

3.因为我的server上运行者leanote且占用了9000端口,所以在上述两个配置中我将端口修改为了9999

(四)创建测试php页面

1.创建/usr/local/nginx/html/info.php

2.在浏览器中输入 blog.isdevil.com/info.php可以查看内容,有输出则成功

(五)设置服务开机启动

chkconfig --levels 235 mysqld on
chkconfig --levels 235 php-fpm on
  • 由于我的服务器上的nginx时手动编译安装的,所以不能直接用上面的命令使其自动开机启动
  • 设置nginx开机启动,参见另一篇文章nginx设置开机启动

参考资料:http://www.jyguagua.com/?p=3236

转载请注明:大魔王ISDevil's Blog » 安装wordpress前的准备

喜欢 ( 0)

你可能感兴趣的:(安装wordpress前的准备)