一、
nginx简介Nginx ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx作为负载均衡服务器:Nginx既可以在内部直接支持 Rails 和 PHP 程序对外进行服务,也可以支持作为 HTTP代理服务器对外进行服务。nginx网站国内的用户有:百度、新浪、网易、腾讯等等。
二、Nginx的安装
下载Nginx(http://nginx.org/en/download.html),最新的好像是nginx-1.9.3。
下载:wget http://nginx.org/download/nginx-1.9.3.tar.gz安装:在安装前安装ngxin所需的模块,以及编译c,c++的软件yum install gcc-c++yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel解压:比如文件下载在/home/andy/目录下tar xzvf nginx-1.9.3.tar.gz cd nginx-1.9.3安装Nginx所需的模块./configure --prefix=/home/nginx--with-http_stub_status_module--with-debug --with-http_realip_module--with-http_ssl_module编译安装make make install启动Nginx cd sbin./nginx Nginx在宝塔面板中轻松管理Nginx高性能Web服务器。提供可视化配置反向代理、负载均衡、SSL证书及HTTP缓存功能,一键优化高并发性能,助您高效搭建稳定、快速的网站运行环境。
下载重新启动cd sbin./nginx -s reload
三、安装出现的问题
如果启动时出现如下问题时1:端口被占用说明:80端口已被占用netstat -anp | grep 80 查询占用80端口的进程杀死该进程kill -s 9 pid(进程id)
2:错误为:./configure: error: the HTTP rewrite module requires thePCRE library.
解决办法:安装pcre-devel模块yum -y install pcre-devel 3:错误提示:./configure: error: the HTTP cache module requires md5functionsfrom OpenSSL library. You can either disable the module by using--without-http- cache option, or install the OpenSSL library into the system,or build the OpenSSL library statically from the source with nginx by using--with-http_ssl_module -- with-openssl=options.
解决办法:
yum -yinstall openssl openssl-devel安装完毕。
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了Nginx在Linux下的安装部署,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
