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