(reprint) Ubuntu build WordPress and use Nginx configuration agent

Source: Internet
Author: User
Tags fpm wordpress database

Download WordPress

wget http://wordpress.org/latest.tar.gz

Unzip the file package. The assumption is extracted to the user's home directory.

TAR-XZVF latest.tar.gz

Create a WordPress database and users

Log in to MySQL

Mysql-u root-p

To create a database:

CREATE DATABASE WordPress;

To create a MySQL user:

CREATE USER [email protected];

Set Password:

SET PASSWORD for [email protected]= PASSWORD ("Your PASSWORD");

To configure permissions:

GRANT all privileges the wordpress.* to [e- Mail protected] identified by ' your password ';
FLUSH privileges;

Configure WordPress

Copy the configuration sample file. Note that the command needs to be modified according to the file's storage path:

CP ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

To edit a configuration file:

sudo vi ~/wordpress/wp-config.php

Modify the following options:

* * MySQL Settings-specific information from the host you are using * *//^m/** WordPress database name */define (' WordPress ');  /** MySQL Database username */define (' WordPress ');  /** MySQL Database password */define (' your password ');        

Copying files to the root directory of the Web site generally sets/var/www as the root of the Web site.

sudo mkdir-p/var/www

Copy files:

sudo cp-r ~/wordpress/*/var/www

Fix permissions:

sudo chown-r www-data:www-data/var/www
Configure Nginx

Now you need to set the Nginx virtual host. You can either use the default configuration or copy it again.

sudo vi/etc/nginx/sites-available/default

Change the server configuration to the following:

server {        listen   ;        root/var/www;        Index index.php index.html index.htm;        server_name www.darrenfang.com;        Location/{                try_files $uri $uri//index.php?q= $uri & $args;        }        Error_page 404/404.html;        Error_page 502 503 504/50x.html;        Location =/50x.html {              root/usr/share/nginx/www;        }        # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location        ~ \.php$ {                try_files $uri =404;
      #fastcgi_pass 127.0.0.1:9000;                # with PHP5-FPM:                fastcgi_pass unix:/var/run/php5-fpm.sock;                Fastcgi_index index.php;                Include Fastcgi_params;         }}

Restart Nginx and PHP-FPM:

sudo service nginx restartsudo service php5-fpm restart
Access the corresponding server_name.

(reprint) Ubuntu build WordPress and use Nginx configuration agent

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.