enginx--Simple article

Source: Internet
Author: User

Enginx (Engin x) is specifically developed for performance optimization and only handles static pages.

Installation Preparation:

Nginx-1.9.4.tar.gz

Installation:

Resolving dependency Packages

Yum-y Install Pcre-devel OpenSSL openssl-develzlib-devel


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/97/wKioL1Xn-XzQo1Z7AAORV48cxVQ763.jpg "title=" 2015-09-03_153120.png "alt=" Wkiol1xn-xzqo1z7aaorv48cxvq763.jpg "/>

Create the required account for Nginx

Useradd-m-s/sbin/nologin Nginx


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/97/wKioL1Xn-a2jSpeRAADZ8DLR6ao766.jpg "title=" 2015-09-03_153153.png "alt=" Wkiol1xn-a2jsperaadz8dlr6ao766.jpg "/>


Compile and install Nginx

Tar zxf nginx-1.9.4.tar.gz-c/usr/src/

cd/usr/src/nginx-1.9.4

./configure--prefix=/usr/local/nginx \

--user=nginx \

--group=nginx\

--with-http_stub_status_module\

--with-http_ssl_module

make&& make Install


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/9A/wKiom1Xn9-vhTJyfAAB3IBWBcLI225.jpg "title=" 2015-09-03_153329.png "alt=" Wkiom1xn9-vhtjyfaab3ibwbcli225.jpg "/>


Configuration

After the installation is complete the optimization:

Ln-s/usr/local/sbin/nginx/usr/local/sbin

To see if the soft link was successful:

Ls-l/usr/local/sbin/nginx

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/9A/wKiom1Xn-JKDlwe4AAD_yoS1LI0377.jpg "title=" 2015-09-03_153634.png "alt=" Wkiom1xn-jkdlwe4aad_yos1li0377.jpg "/>

Check file for syntax errors

Nginx-t

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/9B/wKiom1Xn-MChbyaxAAEHbvj1Ar0079.jpg "title=" 2015-09-03_153718.png "alt=" Wkiom1xn-mchbyaxaaehbvj1ar0079.jpg "/>

Writing a simple Web page

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/9B/wKiom1Xn-W7QsWVSAABVZKecXrA537.jpg "title=" 2015-09-03_154013.png "alt=" Wkiom1xn-w7qswvsaabvzkecxra537.jpg "/>

Start the service

Nginx

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/9B/wKiom1Xn-aWRU4KXAACyjbYgxDk158.jpg "title=" 2015-09-03_154100.png "alt=" Wkiom1xn-awru4kxaacyjbygxdk158.jpg "/>

Access test:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/97/wKioL1Xn-_bDXW97AABQLvSn2q8695.jpg "title=" 2015-09-03_154153.png "alt=" Wkiol1xn-_bdxw97aabqlvsn2q8695.jpg "/>

Editing Nginx's service script

#!/bin/bash#chkconfig:-88#description:nginx Server Control scripts.n_p= "/usr/local/nginx/sbin/nginx" P_D= "/usr/ Local/nginx/logs/nginx.pid "#!/bin/bash#chkconfig:135 100#description:nginx server scriptsn_p="/usr/local/nginx/ Sbin/nginx "p_d="/usr/local/nginx/logs/nginx.pid "Case" $ "instart" $N _p;; Stop) kill-s QUIT $ (cat $P _d);; Restart) $ stop $ start; Reload) kill-s HUP $ (cat $P _d);; *) echo "usage:$0 {start|stop|restart|reload}" exit 1;; Esacexit 0

Test script:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/9B/wKiom1XoBDjwst6IAAClauxKmzY408.jpg "title=" 2015-09-03_162606.png "alt=" Wkiom1xobdjwst6iaaclauxkmzy408.jpg "/>

Configuring Nginx Cores and Threads

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/9B/wKiom1XoBIuQgvnZAACfLZBZnW0724.jpg "title=" 2015-09-03_162714.png "alt=" Wkiom1xobiuqgvnzaacflzbznw0724.jpg "/>

Turn on the option to avoid network congestion.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/9B/wKiom1XoBTrg_YDAAAEhSIlgKZU723.jpg "title=" 2015-09-03_163026.png "alt=" Wkiom1xobtrg_ydaaaehsilgkzu723.jpg "/>

Configure host name, character set support, and access State statistics.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/97/wKioL1XoCIvT1GYQAADjEjj0kr4521.jpg "title=" 2015-09-03_163453.png "alt=" Wkiol1xocivt1gyqaadjejj0kr4521.jpg "/>

Access test:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/9B/wKiom1XoB1GiKxwoAACMc_CVyf4394.jpg "title=" 2015-09-03_163928.png "alt=" Wkiom1xob1gikxwoaacmc_cvyf4394.jpg "/>

To create a virtual host directory:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/9B/wKiom1XoCDigOASSAADB2Y2rSbw007.jpg "title=" 2015-09-03_164308.png "alt=" Wkiom1xocdigoassaadb2y2rsbw007.jpg "/>

To change the configuration:

server {Listen 8000;        server_name cjl.com;            Location/{ROOT/WEB/WWW/2;        Index index.html index.htm index.php; }    }

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/9F/wKioL1XpiBWS4q7GAAD-YpdRT8c397.jpg "title=" 2015-09-04_195144.png "alt=" Wkiol1xpibws4q7gaad-ypdrt8c397.jpg "/>

Restart Service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/A3/wKiom1XphoHw9wh2AAGuzBpUk6A734.jpg "title=" 2015-09-04_195428.png "alt=" Wkiom1xphohw9wh2aaguzbpuk6a734.jpg "/>

This article is from the "XXX" blog, please be sure to keep this source http://moumou.blog.51cto.com/9995443/1691382

enginx--Simple 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.