首页 > 网站 > Nginx > 正文

Linux下安装配置nginx详解

2024-08-30 12:23:47
字体:
来源:转载
供稿:网友

一、Linux下安装配置nginx

第一次安装nginx,中间出现的问题一步步解决。

用到的工具secureCRT,连接并登录服务器。

1.1 rz命令,会弹出会话框,选择要上传的nginx压缩包。

#rz 

1.2 解压

[root@vw010001135067 ~]# cd /usr/local/[root@vw010001135067 local]# tar -zvxf nginx-1.10.2.tar.gz

1.3 进入nginx文件夹,执行./configure命令

[root@vw010001135067 local]# cd nginx-1.10.2[root@vw010001135067 nginx-1.10.2]# ./configure

报错如下:

checking for OS + Linux 2.6.32-431.el6.x86_64 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found

出现这个错误。那么就是gcc 包没有安装。

1.3.1 安装gcc

查看gcc

[root@vw010001135067 nginx-1.10.2]# whereis gccgcc:

安装gcc

[root@vw010001135067 nginx-1.10.2]# yum -y install gcc

安装成功后再次查看

[root@vw010001135067 nginx-1.10.2]# whereis gccgcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

gcc安装好了。

1.3.2 继续执行./configure

[root@vw010001135067 nginx-1.10.2]# ./configurechecking for OS + Linux 2.6.32-431.el6.x86_64 x86_64checking for C compiler ... found......checking for PCRE library ... not foundchecking for PCRE library in /usr/local/ ... not foundchecking for PCRE library in /usr/include/pcre/ ... not foundchecking for PCRE library in /usr/pkg/ ... not foundchecking for PCRE library in /opt/local/ ... not found./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.

出现如上错误。安装pcre-devel

[root@vw010001135067 nginx-1.10.2]# yum install pcre-devel

1.3.3 再次执行./configure

error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option.

如果有这个错误 那么执行

yum install zlib-devel

1.3.4 执行./configure后没有报错

[root@vw010001135067 nginx-1.10.2]# ./configurechecking for OS + Linux 2.6.32-431.el6.x86_64 x86_64checking for C compiler ... found + using GNU C compiler + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) .......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 modules path: "/usr/local/nginx/modules" 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"
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表