博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 下安装nginx的总结 (之前写的有问题))
阅读量:4704 次
发布时间:2019-06-10

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

1. 下载niginx的 tar包

下载路径

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

也可以直接使用命令下载

wget http://nginx.org/download/nginx-1.15.1.tar.gz

2. 下载目录下解压缩

tar -zxvf nginx-1.15.1.tar.gz

3. cd 到目录里面进行处理

./configure

4. 安装时会报错 主要有:

./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=
option.需要pcre./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=
option.需要zlib

一般linux里面安装了 prce和 zlib 但是没有安装devel 包 需要进行安装 

yum install -y prce-develyum install -y zlib-devel

5. 再次执行 ./confiure命令成功

反馈安装信息

Configuration summary  + using system PCRE library  + OpenSSL library is not used  + 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"

6. 执行 make 和 make install 进行安装

make and make install

9. 创建软连接

ln /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

10. 直接启动

nginx

遇到报错如图示时

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] still could not bind()

11. 修改配置文件

查看配置文件位置nginx -t 结果为

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

修改配置文件

vim /usr/local/nginx/conf/nginx.conf

将端口绑定修改一下

 

 再次启动即可

 

转载于:https://www.cnblogs.com/jinanxiaolaohu/p/9299108.html

你可能感兴趣的文章
jmeter配置远程负载jmeter执行性能测试
查看>>
“数学口袋精灵”App的第一个Sprint计划
查看>>
svn1.6在centos6下的使用
查看>>
小鸡啄米问题求解
查看>>
Castle.net
查看>>
HDU1532 网络流最大流【EK算法】(模板题)
查看>>
POJ 2594 Treasure Exploration (Floyd+最小路径覆盖)
查看>>
数字图像处理 博客目录索引
查看>>
nodejs+redis使用
查看>>
prime算法的使用
查看>>
Jedis - hello world
查看>>
Ehcache(2.9.x) - API Developer Guide, Cache Eviction Algorithms
查看>>
把最近这些安全的问题整理一下
查看>>
【转】如何避免OOM总结
查看>>
java 类与对象
查看>>
git push 每次都要输入用户名密码
查看>>
远程桌面无法复制粘贴
查看>>
对错排认识。
查看>>
js高级程序设计——数据属性和访问器属性
查看>>
ArcGIS客户端API中加载大量数据的几种解决办法(以Silverlight API为例)
查看>>