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

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native