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  目录下面



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


至此 安装完成

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

1.启动nginx

cd sbin/

./nginx

2.查看nginx




3. web访问




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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容