Linux下安装Nginx

来源:互联网 发布:csi网络犯罪调查有罗素 编辑:程序博客网 时间:2024/05/01 23:37

以下内容在CentOS下亲测可用。

1   安装编译需要的开发工具和开发库

yum update
yum groupinstall “Development Tools” “Development Libraries”
yum install pcre pcre-devel

2  下载ngx_openresty

wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz
tar xvzf ngx_openresty-1.7.2.1.tar.gz

3   配置

cd ngx_openresty-1.7.2.1
./configure

4  TCP模块安装方式

./configure –prefix=/usr/local/nginx –with-stream

5   编译并安装

make && make install

6  ngx启动脚本

下载地址:http://download.csdn.net/detail/yaoxun1990/9236431

7   然后给文件加上可执行权限

chmod +x /etc/init.d/ngx

8   启动nginx

/etc/init.d/ngx start

9   关闭nginx

/etc/init.d/ngx stop

10   重新加载配置

/etc/init.d/ngx reload

0 0
原创粉丝点击