二、Linux安装Nginx
1、下载Nginx.tar.gz
wget http://nginx.org/download/nginx-1.10.3.tar.gz
2、解压缩此Nginx的tar包
tar -zxvf nginx-1.10.3.tar.gz
3、运行命令
./configure
若出现什么C compiler cc is not found,则证明缺少C++运行库。(常见错误之一),这时就需要运行4步骤。若没出现“C compiler cc is not found”这个错误,则不需要运行4
4、安装gcc库
yum -y install gcc gcc-c++ autoconf automake
5、再次运行命令
./configure
如果出现如下错误:the HTTP rewrite module requires the PCRE library。则代表没找到PCRE库,需要进行安装,需要操作6步骤,,若没那个错误,则不需要执行6
6、安装PCRE库
yum -y install pcre pcre-devel
7、再次运行命令
./configure
如果出现如下错误:the HTTP gzip module requires the zlib library。则代表没找到zlib库,需要进行安装,需要操作8步骤,,若没那个错误,则不需要执行8
8、安装zlib库
yum -y install zlib zlib-devel
9、再次运行命令
./configure
出现如下
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
则代表Nginx的configure安装成功
10、执行 make 命令
make
11、执行 make install命令
make install
12、验证是否安装成功的方法
进入usr/local目录。ls 看当前目录有没有一个叫nginx 的目录,有则代表安装成功。
若有兴趣,欢迎来加入群,【Java初学者学习交流群】:458430385,此群有Java开发人员、UI设计人员和前端工程师。有问必答,共同探讨学习,一起进步!
欢迎关注我的微信公众号【Java码农社区】,会定时推送各种干货:
