nginx安装

1.准备环境 centos6.5

yum install gcc-c++

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yuminstall -y openssl openssl-devel


2. 编译

注意:下面 将临时文件目录( --http-client-body-temp-path=/var/temp )指定为/var/temp/nginx,需要在/var下创建temp及nginx目录

tar -zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --help查询详细参数(nginx编译参数)

./configure \

--prefix=/usr/local/nginx \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/temp/nginx/client\

--http-proxy-temp-path=/var/temp/nginx/proxy\

--http-fastcgi-temp-path=/var/temp/nginx/fastcgi\

--http-uwsgi-temp-path=/var/temp/nginx/uwsgi\

--http-scgi-temp-path=/var/temp/nginx/scgi


编译之后会生成 Makefile文件


3. make 

4. make install  安装在  --prefix=/usr/local/nginx  目录下面


nginx安装_第1张图片


sbin下面的 nginx文件 就是 可执行文件


至此 安装完成

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1.启动nginx

cd sbin/

./nginx

2.查看nginx




3. web访问


nginx安装_第2张图片



4. 关闭 nginx

./nginx -s stop

5 优雅重启nginx

./nginx -s reload

6.检查配置文件是否正确 ( -c 在绝对路径下面需要使用)

/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

你可能感兴趣的:(nginx安装)