Install Wordpress in centos 6

Source: Internet
Author: User
Tags mysql host vps install wordpress
1. Two methods to get WordPress

First, you can go to the official WordPress website to check the latest WordPress quantity. For example, WordPress 3.9.1 is:

Http://cn.wordpress.org/wordpress-3.9-zh_CN.zip

Run the mkdir command to create a directory. WordPress is used here and wget is used to request WordPress:



wget http://cn.wordpress.org/wordpress-3.9-zh_CN.zipunzip  wordpress-3.8-zh_CN.zip


Use unzip to decompress the ZIP file.

Then edit the wp-config-sample.php file to primarily modify Database information.


nano wp-config-sample.php



/ ** MySQL database name * /
define (‘DB_NAME’, ‘wordpress’);
 
/ ** MySQL database username * /
define (‘DB_USER’, ‘root’);

/ ** MySQL database password * /
define (‘DB_PASSWORD’, ‘password’)

/ ** MySQL host (without modification) * /
define (‘DB_HOST’, ‘localhost’); 


Enter a database name here, because the database has not yet been created. The username and password of the database are all set in the previous step. Enter them here.

Remember to press Ctrl + O to save the file and select the file name as wp-config.php.

Copy all the files to the/var/www/html directory. Use


cp -rf wordpress/* /var/www/html/  

In this way, WordPress is completed, but some may be a little scared about command operations. In Windows, you can use filezilla to upload local files to VPs. In the file site manager, select create site and select SFTP for the configuration interface protocol.




On the right is the Linux directory, on the left is your computer, right-click a directory or file to upload it. You can select a directory or file on the right to download it to a local directory, which is a bit like FTP.




The upload speed is approximately 40-50 kb/s.


2. Create a database in MySQL


mysql -u root -p


Enter the above command to enter MySQL and enter the password.

Run the following command to create a database named WordPress.


create database wordpress;


Access the IP address through the two steps above. A brand new WordPress can be created. You can install Wordpress by accessing your registered domain name.


3. Import an SQL File

If you want to switch from a VM to VPs, You need to import the SQL file. Run the following command:


Mysql-u username-P Password Database Name <database name. SQL

Note that there is no space between U and user name, P and password!



4. Simple WordPress settings
4.1 modify the size limit of uploaded files

When you try to upload an attachment to the background, you will find:

Maximum upload file size: 2 MB. Very painful. How to modify it?

Use locate to search for the location of the php. ini file.


locate -i php.ini

Edit it:



nano /etc/php.ini

In nano, you can use Ctrl + W to search for text. Here, search for post_max_size and upload_max_filesize, and change them to a larger value. For example, if I change them to 64 m



4.2 rewrite URL settings


In Wordpress, except for the default URL format, all others require URL support. It is not supported by default. VPs can only be implemented by itself. Generally, virtual hosts are enabled by default.


nano /etc/httpd/conf/httpd.conf

Edit the httpd. conf file. CTRL + W search "/var/www/html", find:


<Directory "/var/www/html">
...
# AllowOverride controls what directives may be placed in. htaccess files.
# It Can Be "all", "NONE", or any combination of the keywords:
# Options fileinfo authconfig limit
#
AllowOverride none

Change AllowOverride none to AllowOverride all.


4.3 install the plug-in. For updates, enter the FTP account


nano /etc/httpd/conf/httpd.conf


The reason is that the permissions are insufficient.

Edit the file as follows:

User Apache

Group Apache

Change Group to root. Of course this is risky, but this is the fastest...

Another way is to give the ownership of all WordPress files to the Apache user.

The preceding three operations require Apache restart to take effect.


sudo service httpd restart  


5. Use git in VPS

You can use the following command to install git, which is very simple.


sudo yum install git


If you don't know how to search for git, I won't go into detail here. We will talk about how to use wget to get the latest WordPress. In fact, the most convenient thing is git, set up the complete WordPress on the local Windows Server, install the plug-in, and push all the theme you like to GitHub or Bitbucket, then, clone the complete website in/var/www/html. You can submit an update later. It's cool to conveniently view the modification records at the same time of backup.


1. Reference:

Install Wordpress in centos 6

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.