当前位置:首页 > 操作系统 > Linux

linux下安装nginx

a、下载安装包

nginx-1.8.0.tar.gz

b、安装前提环境gcc(已有跳过)

①:安装gcc(已有的跳过)
[root@localhost /]# yum install gcc-c++
②:安装pcre库(已有的跳过)
yum install -y pcre pcre-devel
③:安装zlib库(已有的跳过)
yum install -y zlib zlib-devel
④:安装openssl库(已有的跳过)
yum install -y openssl openssl-devel

c、编译安装

 

①:解压安装包

[root@localhost ~]# tar -zxvf nginx-1.8.0.tar.gz
[root@localhost ~]#cd nginx-1.8.0

②:在var下建立temp和nginx文件夹

[root@localhost /var]mkdir temp
[root@localhost /temp]mkdir nginx

③:执行configure命令
[root@localhost nginx-1.8.0]#
./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

④:编译
[root@localhost nginx-1.8.0]# make
[root@localhost nginx-1.8.0]# make install

至此安装完毕…………

d、启动nginx

①:启动nginx
[root@localhost sbin]# ./nginx

②:查看nginx进程
[root@localhost sbin]# ps aux | grep nginx

e、停止nginx

①:快速停止(不建议使用)
[root@localhost nginx]# cd /usr/local/nginx/sbin/
[root@localhost sbin]# ./nginx -s stop

②:完整停止(建议使用)
[root@localhost nginx]# cd /usr/local/nginx/sbin/
[root@localhost sbin]# ./nginx -s quit

f、重启nginx

方式一:先停止再启动(建议启动)
[root@localhost sbin]# ./nginx -s quit
[root@localhost sbin]# ./nginx

方式二:重新加载配置文件(修改配置文件后常使用)
[root@localhost sbin]# ./nginx -s reload

至此结束,后续回详细介绍nginx的使用

原文:http://www.cnblogs.com/huanchupkblog/p/5543327.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐