首页 > 代码库 > 编译安装nginx

编译安装nginx


1、首先添加组

groupadd -r  nginx

useradd -g nginx -r nginx

2、解压源码包:

tar xf nginx-1.6.3.tar.gz

cd  nginx-1.6.3

./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi

3、注意临时文件的存放路劲要手动创建

mkdir -pv /var/tmp/nginx/{client,fastcgi,proxy,uvsgi}

添加环境变量

vim /etc/profile.d/nginx.sh

export PATH=/usr/local/nginx/sbin:$PATH

重读环境变量

. /etc/profile.d/nginx.sh

启动nginx

/usr/local/nginx/sbin/nginx

启动时报错

[root@storg ~]# /usr/local/nginx/sbin/nginx技术分享

本文出自 “luo” 博客,请务必保留此出处http://dklwj.blog.51cto.com/9199080/1949570

编译安装nginx