Install nginx and linuxnginx in linux

Source: Internet
Author: User
Tags openssl library install perl

Install nginx and linuxnginx in linux

Download a tar.gz version of nginx from the official website.

Install with make

Step 1: Extract

Tar-zxvf nginx-1.7.4.tar.gz

Step 2: Go to the nginx-1.7.4 and run the./configure command

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[Root @ localhost nginx-1.7.4] #./configure
Checking for OS
+ Linux 2.6.32-431. el6.x86 _ 64 x86_64
Checking for C compiler... not found
./Configure: error: C compiler cc is not found

This error occurs.

The gcc package is not installed. Install gcc, cool.

Yum-y install gcc

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Execute again./configure

./Configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using -- without-http_rewrite_module
Option, or install the PCRE library into the system, or build the PCRE library
Statically from the source with nginx by using -- with-pcre = <path> option.

Yum install pcre-devel

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Execute again./configure
./Configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using -- without-http_gzip_module
Option, or install the zlib library into the system, or build the zlib library
Statically from the source with nginx by using -- with-zlib = <path> option.
Yum install zlib-devel

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Execute again./configure


Configuration summary
+ Using system PCRE library
+ OpenSSL library is not used
+ Using builtin md5 code
+ Sha1 library is not found
+ Using system zlib library

OK. Now you can execute make. If you want to use the openssl function, sha1 function. So install openssl, sha1, cool. Install opensslyum install openssl-devel to install sha1
Yum install perl-Digest-SHA1.x86_64

Enable ssl module execution./configure -- with-http_ssl_module

Enable the server + status page and execute./configure -- with-http_stub_status_module

Start both of them. Execute./configure -- with-http_stub_status_module -- with-http_ssl_module

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Then configre will pass.

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Run the make command

Run the make install command.

So far, nginx is successfully executed.

Zookeeper ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Add the following environment variables to/etc/profile: export NGINX_HOME =/usr/local/nginx.
Export PATH = $ PATH: $ NGINX_HOME/sbin save and execute source/etc/profile to make the configuration file take effect. Run nginx-v to view the version. The nginx installation is successful.


How to install two nginx servers in linux

When installing nginx in linux, you are generally required to set the installation path through prefix in the./configure stage. Therefore, multiple nginx installations can be installed by specifying different prefixes in./configure.
It is worth noting that after installation, the two nginx listening ports should be set to different listening ports. Otherwise, an nginx cannot be started.
. /Configure -- prefix =/home/work/nginx1 ..... // make & make install the first nginx installation configuration. /configure -- prefix =/home/work/nginx2 ..... // The second nginx installation configuration make & make installcd/home/work/nginx1/conf/nginx. conf & modify the listening port of the first nginx .. /home/work/nginx1/sbin/nginxcd/home/work/nginx2/conf/nginx. conf & modify the second nginx listening port .. /home/work/nginx2/sbin/nginx

What can I do to install nginx and PHP in linux?

Website creation and WEB server mainly support websites or WEB software. You can also use PHP to write scripts for execution.

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.