Install Nginx, MySQL, PHP (LEMP), phpMyAdmin and WordPress on Ubuntu

Source: Internet
Author: User
Tags fpm install php install wordpress phpmyadmin

Reprinted from Http://www.cnblogs.com/eecs/p/3963869.html

1) Update Apt-get

Terminal command: sudo apt-get update

2) Install MySQL

Terminal command: sudo apt-get install mysql-server php5-mysql

3) Install Nginx

sudo apt-get install Nginx

Nginx does not start on its own, you need to start it sudo service nginx start

The command is shown below, and if the Nginx installation succeeds, it can be accessed in the browser

4) Install PHP

sudo apt-get install PHP5-FPM

5) Configure PHP

Input sudo nano/etc/php5/fpm/php.ini

Find Cgi.fix_pathinfo=1, change 1 to 0, remove;

Then configure the www.conf file

sudo nano/etc/php5/fpm/pool.d/www.conf

Find Listen keyword, change to listen =/var/run/php5-fpm.sock

Start PHP-FPM

sudo service php5-fpm restart

6) Configure Nginx

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

That's it when it opens.

Change into

# Pass the PHP scripts to FastCGI server listening on the PHP-FPM socket

Location ~ \.php$ {

Try_files $uri = 404;

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

Fastcgi_param script_filename documentroot fastcgi_script_name;

Include Fastcgi_params;

}

7) Test Installation success

sudo nano/usr/share/nginx/html/info.php

File, enter

<?php

Phpinfo ();

?>

Restart Nginx after saving

sudo service nginx restart

Enter the URL to see the PHP information page that indicates that the installation was successful.

8) Install phpMyAdmin

sudo apt-get install phpMyAdmin

sudo ln-s/usr/share/phpmyadmin//usr/share/nginx/html/phpmyadmin

9) Install WordPress

The principle above, no longer repeat,/usr/share/nginx/html can be the default access location of the server. Deploy the Web site below with xxxx/you_folder_name access on the URL

Allow fixed-link URL rewriting, modify conf

Location/{
# First attempt to serve request as file, then
# as Directory, then fall back to displaying a 404.
#try_filesurI uri/= 404;
Try_filesurI uri//index.php?q=uri&args;
# Uncomment to enable Naxsi
# Include/etc/nginx/naxsi.rules
}
location/wp-blog/{
Try_files urIuri//wp-blog/index.php? $args;
}

About upload Permission configuration

sudo chown-r www-data your-foldersudo chmod-r 775 Your-folder

Some settings for WordPress access acceleration

An article that disables Google fonts http://www.wpyou.com/disable-goole-fonts.html

No Google fonts and Avatar avatars

/**
* Delete Google Fonts or install Disable Google Fonts plugin directly
*/
function Coolwp_remove_open_sans_from_wp_core () {
Wp_deregister_style (' Open-sans ');
Wp_register_style (' Open-sans ', false);
Wp_enqueue_style (' Open-sans ', ');
}
Add_action (' init ', ' coolwp_remove_open_sans_from_wp_core ');

Some plugin records

Disable Google Fonts

Googlefonts to 360

Remove Open Sans font from WP core

Useso take over Google

WP CN Excerpt

Disable Gravator

Create a cache directory

Create a folder in the same level of Wp-content, named Avatar, and set the folder's permissions to 0755 (if 0755 doesn't work, try 0777).

Set the default avatar

Prepare a size-appropriate default avatar, named "Default.jpg", and put it in the Avatar folder.

Add cache Code

Copy the following code into the template's functions.php file

function My_avatar ($avatar) {  $tmp = Strpos ($avatar, ' http ');  $g = substr ($avatar, $tmp, Strpos ($avatar, "'", $tmp)-$tmp);  $tmp = Strpos ($g, ' avatar/') + 7;  $f = substr ($g, $tmp, Strpos ($g, "?", $tmp)-$tmp);  $w = Get_bloginfo (' Wpurl ');  $e = Abspath. ' Avatar/'. $f. " JPG ';  $t = 1209600; Set 14-day, unit: Seconds  if (!is_file ($e) | | (Time ()-Filemtime ($e)) > $t) {//When the image does not exist or the file is over 14 days    to update copy (Htmlspecialchars_decode ($g), $e);  } else  $ Avatar = STRTR ($avatar, array ($g ~ = $w. '/avatar/'. $f. jpg ');  if (FileSize ($e) <) copy ($w. '/avatar/default.jpg ', $e);  return $avatar;} Add_filter (' Get_avatar ', ' My_avatar ');

  

Install Nginx, MySQL, PHP (LEMP), phpMyAdmin and WordPress on Ubuntu

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.