Nginx installation and simple stress test

Source: Internet
Author: User
Tags openssl sendfile

Installing compilers and related tools

[root@localhost softs]# yum install gcc gcc-c++ autoconf automake-y

Module dependencies: Nginx Some of the modules require Third-party library support, gzip need Libzip library, rewrite need Pcre library, SSL needs LIBSSL library, etc., you can use Yum installation to resolve these dependent libraries.

[Root@localhost ~]# yum install zlib zlib-devel OpenSSL openssl-devel pcre pcre-devel-y

===========> some of the contract and support packages required for the installation process

Install pcre-8.33.tar.gz ======> Perl language-compatible regular expressions

[Root@localhost pcre-8.33]#./configure--enable-utf8--enable-rebuild-chartables--enable-newline-is-any-- Enable-pcregrep-libz && make && make install

Install Nginx

[Root@localhost nginx-1.5.6]# yum install gd gd-devel libxml2 libxml2-devel

===========> Installation Gd,libxml Library and development Kit

[Root@localhost nginx-1.5.6]#./configure--error-log-path=/var/log/nginx/error.log--pid-path=/var/run/nginx/ Nginx.pid--user=nginx--group=nginx--with-rtsig_module--with-select_module--with-poll_module Module--with-http_realip_module--with-http_addition_module--with-http_xslt_module--with-http_image_filter_ Module--with-http_sub_module--with-http_dav_module--with-http_gzip_static_module--with-http_flv_module-- With-http_perl_module--with-perl=/usr/bin/perl--http-log-path=/var/log/nginx/access.log--with-pcre--with-pcre= /usr/src/lnmp/pcre-8.33/--with-http_stub_status_module

[Root@localhost nginx-1.5.6]# make

[Root@localhost nginx-1.5.6]# make install

Modifying the Nginx configuration file

[Root@localhost nginx-1.5.6]# vi/usr/local/nginx/conf/nginx.conf

User Nginx; ### #指定nginx的默认用户

Worker_processes 1;### #启动进程, usually set to equal number of CPUs

Error_log/var/log/nginx/error.log; ### #nginx的错误日志存放目录

#error_log Logs/error.log Notice;

Error_log/var/log/nginx/error.log info; ### #nginx的错误日志级别设置

pid/var/run/nginx/nginx.pid;### #nginx运行进程pid

Events {

Worker_connections 1024; # # #单个后台worker The maximum number of concurrent links for process processes

}

HTTP {

Include Mime.types; ###### #设定mime类型, type is defined by Mime.type file

Default_type Application/octet-stream;

# # #MIME类型就是设定某种扩展名的文件用一种应用程序来打开的方式类型, when the extension file is accessed, the browser automatically uses the specified application to open the

Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" "$status $body _bytes_sent" $http _referer "" "$http _user_agent" "$http _x_forwarded_for";

=========> specify the format of the log

Access_log/var/log/nginx/access.log main; # # #日志目录

Sendfile on; ### #sendfile instruction Specifies whether Nginx calls the Sendfile function (zero copy) to output the file, and for normal applications, it must be set to ON, and if used for download applications disk IO Heavy load applications can be set to off to balance disk with network i/ o processing speed, reduce the uptime of the system.

gzip on; # # # # #开启zip压缩

server {

Listen 80;

server_name localhost;

root/www; ### #DocumentRoot

Index index.html index.htm index.php; ### #支持的索引类型

CharSet gb2312;### #支持的语言

Location/{try_files $uri $uri//index.php;

}

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/

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.