歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Linux Nginx

Linux Nginx

日期:2017/3/3 11:26:09   编辑:Linux技術

一、NGINX的應用場合

1.靜態服務器(圖片,視頻服務),另一個是lighttpd:百度貼吧、豆瓣;

html,js,css,.flv等;

2.動態服務,nginx+fastcgi的方式運行php,jsp。並發:500—1500;

apache+php,lighttpd+fcgi php;

3.反向代理(代替處理),負載均衡(lb)。日pv2000w以下,都可以直接用nginx做代理;

擴展:正向代理...

4.緩存服務。

二、安裝 Nginx

1.安裝准備。

1.1.安裝pcre。

***CRE(Perl Compatible Regular Expressions)是一個Perl庫,包括 perl 兼容的正則表達式庫。

***官網:http://www.pcre.org/。

***安裝作用:為了使Nginx支持HTTP Rewrinre模塊。

兩種方法:a.編譯;

b.yum 這裡介紹yum安裝。

1.2安裝openssl

2.完整安裝過程。

2.1

yum install -y pcre pcre-devel

yum install openssl open-devel -y

tar xf nginx-1.6.2.tar.gz

cd nginx-1.6.2

./configure --help

useradd -s /sbin/nologin -M nginx

tail -1 /etc/passwd =======>>>習慣修改檢查!

./configure --user=nginx --group=nginx --prefix=/application/nginx1.6.2 --with-http_stub_status_module --with-http_ssl_module

echo $?

make && make install

echo $?

ln -s /application/nginx1.6.2/ /application/nginx

2.2

啟動nginx

/application/nginx/sbin/nginx –t ====>>>>檢查語法

/application/nginx/sbin/nginx ====>>>>直接啟動

netstat -lnput|grep nginx

lsof -i :80

curl 192.168.21.128

Windows浏覽器訪問:“Welcome to nginx!” ====>>>>安裝成功!

安裝過程中出現的問題解決:

1.“./configure: error: SSL modules require the OpenSSL library.

You can either do not enable the modules, or install the OpenSSL library

into the system, or build the OpenSSL library statically from the source

with nginx by using --with-openssl=<path> option.

=======================================================

解決辦法:yum install openssl openssl-devel –y 或者 yum install openssl openssl* -y

=======================================================

2.Windows浏覽器訪問失敗

2.1. ping ===========>>>物理通不通

2.2. telnet ===========>>>浏覽器到web服務通不通

2.3. 服務器本地curl =========>>>web服務開沒開

本文出自 “randolph” 博客,轉載請與作者聯系!

Copyright © Linux教程網 All Rights Reserved