Ubuntu 12.04 under Nginx installation steps

Source: Internet
Author: User

2013-12-05 10:25 2289 People read comments (0) favorite reports Classification:Ubuntu/linux (+)Nginx (4)

Transferred from: http://blog.csdn.net/accccaa/article/details/12215007

Nginx is a powerful high-performance reverse proxy server, characterized by a small amount of memory, concurrency, high concurrency is a good substitute for Apache, can support up to 50,000 concurrent connection number of responses, so powerful weapons, How exactly does the Linux system play his advantage and find its niche?

First we have to install Nginx on the ubuntu12.04, my server has been successfully installed Nginx, the following my personal experience to share, in order to encourage mutual encouragement.

Come on:

Ready to work, Nginx gzip module requires zlib Library, rewrite module needs pcre Library, SSL module requires OpenSSL Library, then we will install them sequentially.

zlib Library Installation :

1) Download: wget http://zlib.net/zlib-1.2.8.tar.gz

2) Decompression: TAR-ZXVF zlib-1.2.8.tar.gz

3) Install:./configure–prefix=/usr/local/zlib-1.2.8 && make &&make Install

pcre Library Installation :

1) Download: wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz

2) Installation:

./configure
--prefix=/usr/local/pcre-8.33
--libdir=/usr/local/lib/pcre
--includedir=/usr/local/include/pcre
Make
Make install

OpenSSL library installation :

1) Download: wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz

2) Installation:

./configure--prefix=/usr/local/openssl-1.0.1e && make && make install

See if the installation was successful with the OpenSSL version command.

The preparation is ready, we'll start installing nginx immediately.

First go to ngxin official website download: wget http://nginx.org/download/nginx-1.4.2.tar.gz

After decompression through the installation of a compilation installation, detailed Ubuntu under the Nginx installation command as follows, note : DIR is the source path :

–with-pcre=dir set path to Pcre library sources

–with-openssl=dir set path to OpenSSL library sources

–with-zlib=dir set path to zlib library sources

For example, I configured this, a command is done:

./configure
--prefix=/usr/local/nginx
--with-pcre=/home/jinbao/work/software/pcre-8.33
--with-zlib=/home/jinbao/work/zlib-1.2.8
--with-http_ssl_module
--with-openssl=/home/jinbao/work/openssl-1.0.1e
--sbin-path=/usr/local/nginx

At this point, our Nginx installation success, through the command Sudo/usr/local/nginx/nginx start it.

Off Nginx: Using Ps-ef | grep nginx View Nginx main process PID, and then sudo kill-9 pid can terminate nginx operation.

Take a look at our results, open your browser, visit http://localhost, and get started on your Nginx installation journey, Pro!

Nginx Configure parameter Description: Http://wiki.nginx.org/NginxChsInstallOptions

When we use Nginx, if we want to let some attachments such as txt,pdf,doc and so on not directly in the browser open, and pop-up Save as a dialog box (that is, download), you can add the following configuration in Nginx:

Location/
{
if ($request _filename ~* ^.*?\. ( TXT|DOC|PDF|RAR|GZ|ZIP|DOCX|EXE|XLSX|PPT|PPTX) $)

{
Add_header content-disposition: ' Attachment; ';
}
}

If a client requests a file with a txt, PDF, doc, or XLS suffix, the browser appears with the Save As dialog box.

Change the Nginx Web root directory where the location/{root HTML will be;        Index index.php index.html index.htm;            } changed to location/{root/home/www;        Index index.php index.html index.htm; }

Ubuntu 12.04 under Nginx installation steps

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.