Ubuntu Installation nginx-1.8.0.tar.gz

Source: Internet
Author: User
Tags create directory install openssl openssl library

installation package:nginx-1.8.0.tar.gz


Mount Windows Disk

Mount-t cifs-o username=xx,passwd=yyyy//IP address/share/mnt


Unzip the Nginx bag to/usr/src/

sudo tar-zxf nginx-1.8.0.tar.gz-c/usr/src/


Create nginx users and Groups

Cat/etc/group

sudo groupadd–g 112–r nginx

sudo useradd–u 112–r–g nginx

ID Nginx

uid=112 (Nginx) gid=112 (nginx) groups=112 (Nginx)


compiling Nginx

cd/usr/src/nginx-1.8.0

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

--sbin-path=/usr/sbin/nginx \

--conf-path=/etc/nginx/nginx \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--pid-path=/var/run/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--http-client-body-temp-path=/var/tmp/nginx/client\

--http-proxy-temp-path=/var/tmp/nginx/proxy \

--HTTP-FASTCGI-TEMP-PATH=/VAR/TMP/NGINX/FCGI \

--HTTP-UWSGI-TEMP-PATH=/VAR/TMP/NGINX/UWSGI \

--with-pcre


Error:

./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 intothe system, or build the PCRE library

Statically from the source with Nginx byusing--with-pcre=<path> option.

missing pcre-devel package

Solve:

Centos :yum installpcre-devel can be solved

Ubuntu:sduo Apt-get Pcre-devel can not find pcre-devel package , Debian/ubuntu system under the name changed, the name is libpcre3 Libpcre3-dev the Correct command is as follows:

sudoapt-get Install libpcre3 Libpcre3-dev


Continue compiling nginx


Error:

./CONFIGURE:ERROR:SSL modules require the OpenSSL library.

You can either does not enable the Modules,or install the OpenSSL library

Into the system, or build the openssllibrary statically from the source

With Nginx by using--with-openssl=<path>option.

missing OpenSSL libssl-dev package

Solve:

Centos:yum Install Openssl-devel

Ubuntu:sudo apt-get Install OpenSSL Libssl-dev


Recompile succeeded

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

--sbin-path=/usr/sbin/nginx\

--conf-path=/etc/nginx/nginx \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--pid-path=/var/run/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--http-client-body-temp-path=/var/tmp/nginx/client\

--http-proxy-temp-path=/var/tmp/nginx/proxy \

--HTTP-FASTCGI-TEMP-PATH=/VAR/TMP/NGINX/FCGI \

--HTTP-UWSGI-TEMP-PATH=/VAR/TMP/NGINX/UWSGI \

--with-pcre

sudo make

Error:

Mkdir:cannot Create directory '/usr/local/nginx ': Permission denied, creating /usr/src/nginx permissions enough, I use sudo do not know why still insufficient authority, and then directly Mkdir/usr/src/nginx problem OK

FIX:sudo mkdir/usr/src/nginx

sudo make && make install


Installation Complete


Start Nginx

Nginx startup file in --sbin-path=/usr/sbin/nginx

sudo cp/usr/sbin/nginx/etc/init.d/

sudo service nginx start Nginx

Error:

Nginx: [Emerg] mkdir () "/var/tmp/nginx/client" failed (2:no such file or directory) no

/var/tmp/nginx/client Directory

Solve:

sudo mkdir-p/var/tmp/nginx/client

sudo service Nginx

View ports

sudo netstat–ntulp

Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 23451/nginx
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1106/sshd
TCP6 0 0::: $:::* LISTEN 1106/sshd
UDP 0 0 0.0.0.0:68 0.0.0.0:* 826/dhclient
UDP 0 0 0.0.0.0:23296 0.0.0.0:* 826/dhclient
UDP6 0 0::: 43770:::* 826/dhclient

Boot auto Start chkconfig

Ubuntu does not support Chkconfigand needs to be installed

Chkconfig.deb:http://download.csdn.net/download/hylongsuny/5276536

Dpkg–i Chkconfig.deb

sudo chkconfig--add nginx

sudo chkconfig nginx on

Error:

/sbin/insserv:nosuch file or directory

Solve:

sudo find/-name Insserv

sudo ln-s/usr/lib/insserv/insserv/sbin/soft link to/sbin/

sudo chkconfig nginx on chkconfig–list view nginx service is OK , but reported the following error:

[Email protected]:/var/log$ sudo chkconfignginx on

Insserv:warning:script ' K20nginx ' missinglsb tags and overrides

Insserv:warning:script ' Nginx ' missinglsb tags and overrides

The script you is attempting to invoke Hasbeen converted to an upstart

Job, but Lsb-header was not supported Forupstart jobs.

Insserv:warning:script ' friendly-recovery ' missing LSB tags and overrides

Insserv:default-start Undefined, Assumingempty Start runlevel (s) for script ' Friendly-recovery '

Insserv:default-stop undefined, assuming empty Stop runlevel (s) for script ' Friendly-recovery '

The script you is attempting to invoke Hasbeen converted to an upstart

Job, but Lsb-header was not supported Forupstart jobs.

Insserv:warning:script ' cron ' missing lsbtags and overrides

Insserv:default-start Undefined, Assumingempty Start runlevel (s) for script ' cron '

Insserv:default-stop undefined, assuming empty Stop runlevel (s) for script ' cron '


on the internet for a long time,Chkconfig applies to Redhat,ubuntu/debian should use the UPDATE-RC.D command, you can use sudo Update-rc.dnginx defaults to replace sudochkconfig Nginx on start nginx

Sudorm-rf/sbin/insserv update-rc.d can be removed without the need for software connection

SUDOUPDATE-RC.D Nginx Defaults

Update-rc.d:warning:/etc/init.d/nginx Missing LSB information

Update-rc.d:see

Adding system Startup For/etc/init.d/nginx ...

/etc/rc0.d/k20nginx. /init.d/nginx

/etc/rc1.d/k20nginx. /init.d/nginx

/etc/rc6.d/k20nginx. /init.d/nginx

/etc/rc2.d/s20nginx. /init.d/nginx

/etc/rc3.d/s20nginx->. /init.d/nginx

/etc/rc4.d/s20nginx. /init.d/nginx

/etc/rc5.d/s20nginx. /init.d/nginx

sudo chkconfig--list |grep nginx

Nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off


Access test

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/19/wKioL1XF_kmhzRDtAAFOO68kB0E101.jpg "title="][6kg~ 4R ' Axijy_f8gcq9wn.png "alt=" Wkiol1xf_kmhzrdtaafoo68kb0e101.jpg "/>




Ubuntu Installation nginx-1.8.0.tar.gz

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.