CentOS 6.5 下编译安装 Nginx 1.8.0

前端之家收集整理的这篇文章主要介绍了CentOS 6.5 下编译安装 Nginx 1.8.0前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装编译依赖的包

yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl 
yum -y install openssl-devel pcre pcre-devel

安装 Nginx

# 下载源码
wget  http://Nginx.org/download/Nginx-1.8.0.tar.gz  

# 解压
tar zxvf Nginx-1.8.0.tar.gz
cd Nginx-1.8.0

# 编译安装
./configure
make && make install

运行 configure 后可以看到一大串配置信息:

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

注意上面的配置信息,Nginx配置文件/usr/local/Nginx/conf/ 目录下,此时可以编辑 /usr/local/Nginx/conf/Nginx.conf 文件修改配置,这个就不多说了。

配置完可以用 Nginx -t 检查配置是否正确。

修改完之后就可以启动 Nginx 了:

Nginx -c /usr/local/Nginx/conf/Nginx.conf 

# 查看 Nginx 进程
ps aux | grep Nginx
原文链接:https://www.f2er.com/centos/381070.html

猜你在找的CentOS相关文章