博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【原创】Linux下的ngix服务器安装步骤
阅读量:6221 次
发布时间:2019-06-21

本文共 3188 字,大约阅读时间需要 10 分钟。

1.首先下载ngix的源码linux版本【1.5.8版本】

http://nginx.org/en/download.html

2.下载PCRE library,是安装ngix的必备包之一

[root@localhost ngix]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F&ts=1389689100&use_mirror=jaist---------------------------------[root@localhost pcre-8.34]# unzip pcre-8.34.zip[root@localhost pcre-8.34]# cd pcre-8.34[root@localhost pcre-8.34]# ./configure.....shenglue[root@localhost pcre-8.34]# make[root@localhost pcre-8.34]# make installmake[1]: Entering directory `/home/ngix/pcre-8.34'make[2]: Entering directory `/home/ngix/pcre-8.34' /bin/mkdir -p '/usr/local/lib' /bin/sh ./libtool   --mode=install /usr/bin/install -c   libpcre.la libpcreposix.la libpcrecpp.la '/usr/local/lib'

3.解压ngix,首先检测检测

[root@localhost nginx-1.5.8]# ./configure 【--prefix=/ngix --with-pcre=/usr/local/pcre】

 

Configuration summary  + using system PCRE library  + OpenSSL library is not used  + using builtin md5 code  + sha1 library is not found  + using system zlib library  nginx path prefix: "/usr/local"  nginx binary file: "/usr/local/sbin/nginx"  nginx configuration prefix: "/usr/local/conf"  nginx configuration file: "/usr/local/conf/nginx.conf"  nginx pid file: "/usr/local/logs/nginx.pid"  nginx error log file: "/usr/local/logs/error.log"  nginx http access log file: "/usr/local/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"

通过后编译、安装:

[root@localhost nginx-1.5.8]# make[root@localhost nginx-1.5.8]# make install

4.查看是否安装成功

[root@localhost sbin]# ./nginx -t nginx: the configuration file /usr/local/conf/nginx.conf syntax is oknginx: configuration file /usr/local/conf/nginx.conf test is successful

有时会报错:

[root@localhost sbin]# ./nginx -t ./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

这样的话查看一下详细信息:

[root@localhost conf]# ldd $(which /usr/local/sbin/nginx)linux-gate.so.1 => (0x0071b000)libpthread.so.0 => /lib/libpthread.so.0 (0×00498000)libcrypt.so.1 => /lib/libcrypt.so.1 (0×00986000)libpcre.so.1 => not foundlibcrypto.so.6 => /lib/libcrypto.so.6 (0×00196000)libz.so.1 => /lib/libz.so.1 (0×00610000)libc.so.6 => /lib/libc.so.6 (0x002d7000)/lib/ld-linux.so.2 (0x006a8000)libdl.so.2 => /lib/libdl.so.2 (0x008c3000)

链接文件导致,重新链接一下:

[root@localhost pcre]# cd /lib[root@localhost lib]# ln -s libpcre.so.0.0.1 libpcre.so.1[root@localhost lib]# [root@localhost lib]#

再次检查:

[root@localhost sbin]# ./nginx -t nginx: the configuration file /usr/local/conf/nginx.conf syntax is oknginx: configuration file /usr/local/conf/nginx.conf test is successful[root@localhost sbin]#

启动并访问浏览器:

Welcome to nginx!If you see this page, the nginx web server is successfully installed and working. Further configuration is required.For online documentation and support please refer to nginx.org.Commercial support is available at nginx.com.Thank you for using nginx.

 

 

转载于:https://www.cnblogs.com/zhangxsh/p/3519544.html

你可能感兴趣的文章
MySQL服务器安装配置-非安装版、windows版
查看>>
批量往数据库导入数据遇到的问题总结
查看>>
一个小公司的前端笔试HTML CSS JS
查看>>
noip普及组2018T1 标题统计
查看>>
vim配置@year12
查看>>
排序——数据结构课程作业
查看>>
Grunt Gulp Browserify Webpack
查看>>
Shortest Distance from All Buildings
查看>>
rdm代码网址
查看>>
乘方取模计算(模幂计算)
查看>>
Ubuntu安装PyCharm
查看>>
如何将CTB词性标签映射为universalPOs标签
查看>>
BZOJ5299:[CQOI2018]解锁屏幕(状压DP)
查看>>
Mac OSX 快捷键&命令行总览
查看>>
c++面试题之内存分配
查看>>
水果忍者(切西瓜)
查看>>
集合问题
查看>>
HTML
查看>>
渗透测试辅助工具--在线版
查看>>
Python(Handwriting)
查看>>