Second, Ubuntu under the compiler installation Nginx1.8.0

Source: Internet
Author: User
Tags install openssl openssl library

Second, compile and install Nginx1.8.0

Build a LNMP environment under Ubuntu. Compile and install mysql,nginx,php. Finally, install the composer under the Lnmp premise and install the Laravel frame. First, the second step starts compiling the installation Nginx1.8.0.

1. Enter the "/usr/local/src" folder First, then type

"sudo wget http://nginx.org/download/nginx-1.8.0.tar.gz" Enter and wait for the download to complete. After downloading, execute "sudo tar zxvf nginx-1.8.0.tar.gz" to unzip the file.


650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/77/AB/wKiom1Zq_TSDANuFAAEzjlKp2Eg793.png "style=" float: none; "title=" 1.png "alt=" Wkiom1zq_tsdanufaaezjlkp2eg793.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/77/AA/wKioL1Zq_TaTXCT7AABB-DOJQ2c164.png "style=" float: none; "title=" 2.png "alt=" Wkiol1zq_tatxct7aabb-dojq2c164.png "/>

2. then enter the nginx source directory, configure the installation operation. Execute"CD nginx-1.8.0" and then "sudo./configure--prefix=/usr/local/server/nginx--with-http_stub_status_ Module".

If the following error 1 appears :

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/77/AB/wKiom1Zq_TbjWKwyAADpJrbz9V4493.png "style=" float: none; "title=" 3.png "alt=" Wkiom1zq_tbjwkwyaadpjrbz9v4493.png "/>

is the lack of Pcre Library . Workaround:

sudo wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

sudo tar-xzvf pcre-8.38.tar.gz

cd/usr/local/src/pcre-8.38

sudo./configure

sudo make

sudo make install

After installing pcrelibrary , error 2 appears :

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/AA/wKioL1Zq_TjQ4uwwAACIbnkAPfE808.png "style=" float: none; "title=" 4.png "alt=" Wkiol1zq_tjq4uwwaacibnkapfe808.png "/>

Workaround: The zlib library is missing. Execute command: sudo apt-getinstall zlib1g-dev

After installing Zliblibrary, error 3 appears:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/AB/wKiom1Zq_TewxaQ8AACI-uk2QYI948.png "style=" float: none; "title=" 5.png "alt=" Wkiom1zq_tewxaq8aaci-uk2qyi948.png "/>

Workaround: The OpenSSL library is missing.

Execute command sudo apt-get install OpenSSL libssl-dev Libperl-dev

Next; Run command: sudo./configure--prefix=/usr/local/server/nginx--with-http_stub_status_module--with-http_gzip_static_ Module--with-http_ssl_module--with-pcre=. /pcre-8.38/

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/77/AB/wKiom1Zq_TeTpi46AABM-j1VpkE340.png "style=" float: none; "title=" 6.png "alt=" Wkiom1zq_tetpi46aabm-j1vpke340.png "/>

The configuration succeeds if the following conditions occur.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/77/AA/wKioL1Zq_TuCJCuPAAGFEI1gXgw021.png "style=" float: none; "title=" 7.png "alt=" Wkiol1zq_tucjcupaagfei1gxgw021.png "/>

3. Run the command sudo make&& make install

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/77/AA/wKioL1Zq_TyBpkkUAADPikGpDvA747.png "style=" float: none; "title=" 8.png "alt=" Wkiol1zq_tybpkkuaadpikgpdva747.png "/>

4. Copy the following code content to /etc/init.d/nginx, execute "sudo vim/etc/init.d/nginx", and then "sudo chmod +x/etc/ Init.d/nginx".

Code:

#!/bin/bash

#

#chkconfig:-85 15

#description: Nginx is a world Wide Web server.

#processname: Nginx

Nginx=/usr/local/server/nginx/sbin/nginx

Conf=/usr/local/server/nginx/conf/nginx.conf

Case $1in


Echo-n "Starting Nginx"

$nginx-c$conf

echo "Done"

;;


Echo-n "Stopping Nginx"

Killall-9 Nginx

echo "Done"

;;


$nginx-t-c $conf

;;


Echo-n "Reloading Nginx"

PS auxww| grep Nginx | grep Master | awk ' {print $} ' | Xargs Kill-hup

echo "Done"

;;


$ stop

$ start

;;


Ps-aux|grep Nginx

;;

*)

Echo-n "Usage: $ {start|restart|reload|stop|test|show}"

;;

Esac

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/77/AB/wKiom1Zq_TqzEM2pAAAjb23F3gY319.png "style=" float: none; "title=" 9.png "alt=" Wkiom1zq_tqzem2paaajb23f3gy319.png "/>

5. start nginx, execute "sudo/etc/init.d/nginx start" to start Nginx

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/77/AA/wKioL1Zq_Tzx49UEAAAwQWkh2LE544.png "style=" float: none; "title=" 10.png "alt=" Wkiol1zq_tzx49ueaaawqwkh2le544.png "/>

6. The browser enters "http://localhost" and displays the following page, indicating that the server started successfully.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/77/AB/wKiom1Zq_TuxJoYCAACqsbIjXMc053.png "style=" float: none; "title=" 11.png "alt=" Wkiom1zq_tuxjoycaacqsbijxmc053.png "/>

7. Close nginxand perform "Sudo/etc/init.d/nginx stop" to close nginx.

from this,nginx The compilation installation is complete.




This article from the "Good Learning Day Up" blog, please be sure to keep this source http://sunrising.blog.51cto.com/10729461/1722298

Second, Ubuntu under the compiler installation Nginx1.8.0

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.