Ubuntu11.04 lnmp server is successfully installed

Source: Internet
Author: User
Nginx is a lightweight web server, which is well-known because it occupies less system resources. Many large servers are currently using this web server, including Nginx, which is a somewhat notorious TX server in China, in recent years, lnmp has been so popular because it is indeed much more efficient than lamp, mainly because nginx is quite useful for small and medium-sized servers. Without talking nonsense, I started to get started with the subject. After many attempts, I finally succeeded today and provided a lot of reference materials. I saved my Experiment Installation experience: first, I must be firm.

Nginx is a lightweight web server, which is well-known because it occupies less system resources. Many large servers are currently using this web server, including Nginx, which is a somewhat notorious TX server in China, in recent years, lnmp has been so popular because it is indeed much more efficient than lamp, mainly because nginx is quite useful for small and medium-sized servers. Without talking nonsense, I started to get started with the subject. After many times of playing around, I finally succeeded today and found a lot of reference materials. I saved my Experiment Installation experience as follows:

First of all, we must firmly believe that it will succeed. In Ubuntu 11.04, the re-installation was very simple. I used to install the lnmp one-key installation package directly. After several lab failures, I decided to give up, instead, you can directly install the tool through commands in Ubuntu. The installation process is very simple, but you only need a bit of configuration. I will send the configuration code below and copy it directly to use it:

1. Install MYSQL

Sudo apt-get install mysql-server
2. Install NGINX (use the official PPA source to install the latest version ). Note: This is the original author's suggestion, but I think the official source is too slow. You can use 163 of the source and other sources, so this step can be omitted, however, I still list the author.
1) Open https://launchpad.net /~ Follow the instructions in nginx/+ archive/development to add the nginx ppa source for UBUNTU. manually add a method to open the system software source. Add the following addresses to add other software:
Sudo vim/etc/apt/sources. list
Deb http://ppa.launchpad.net/nginx/development/ubuntu maverick main
The deb-src http://ppa.launchpad.net/nginx/development/ubuntu maverick main
2) Add a key and update it.

Sudo apt-key adv -- keyserver keyserver.ubuntu.com -- recv-keys C300EE8C
Sudo apt-get update
3) install NGINX

Sudo apt-get install nginx
3. Install phpy + php-fpm + other modules
1) create a new/var/www/directory. Of course, you have to place the directory on your own. Remember to set the nginx code after modification.

Sudo mkdir/var/www
2) Installation Module

Sudo apt-get install php5-cgi php5-mysql php5-fpm php5-curl php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode
4. modify the configuration file
1) Open/etc/php5/fpm/php. ini.

Sudo vim/etc/php5/fpm/php. ini
Find the code cgi. fix_pathinfo = 1 and change it:

Cgi. fix_pathinfo = 0
2) Modify/etc/nginx/sites-available/default and directly replace all the code in it. refer to the following:

Sudo vim/etc/nginx/sites-available/default
Server {
Listen [:]: 80 default ipv6only = on; # listen for ipv6
Listen 80;
Server_name localhost;
Root/var/www/; # If you modify the preceding directory, modify it here.

# Access_log/var/www/log/xxx-access.log;
# Error_log/var/www/logs/xxx-error.log;

Location /{
Index. php index.html index.htm;
}

# Error_page 404/404 .html;

# Redirect server error pages to the static page/50x.html
#
# Error_page 500 502 503 504/50 x.html;
# Location =/50x.html {
# Root/var/www/nginx-default;
#}

Location ~ \. Php $ {

Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi_params;
}

Location ~ /\. Ht {
Deny all;
}
}
3) Modify/etc/nginx/fastcgi_params and add the following content directly at the end:

Sudo vim/etc/nginx/fastcgi_params
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Fastcgi_param PATH_INFO $ fastcgi_script_name;
Fastcgi_connect_timeout 60;
Fastcgi_send_timeout 180;
Fastcgi_read_timeout 180;
Fastcgi_buffer_size 128 k;
Fastcgi_buffers' 4 256 k;
Fastcgi_busy_buffers_size 256 k;
Fastcgi_temp_file_write_size 256 k;
Fastcgi_intercept_errors on;
4) Restart nginx and php-fpm. The configuration is complete:

Sudo/etc/init. d/nginx restart
Sudo/etc/init. d/php5-fpm reload
Finally, for mysql management problems, download the phpmyadmin source code package and decompress it to/var/www/. Open the browser: http: // your domain name/phpmyadmin/to access the database, note the case sensitivity of "phpmyadmin", because I have encountered such a problem, because the phpmyamdin after downloading and unzipping has uppercase letters, and the linux OS is case sensitive, you can simply change it to lower case. Enjoy your LNMP journey.

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.