微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/centos/381070.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。