linux安装nginx

1.安装依赖

//一键安装上面四个依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

2.下载并解压压缩包

//创建一个文件夹
cd /usr/local
mkdir nginx
cd nginx
//下载tar包
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz

3.安装nginx

//进入目录
cd nginx-1.13.7
//执行命令
./configure
//执行make命令
make
//执行make install命令
make install

 4.检查安装

# cd到刚才配置的安装目录/usr/loca/nginx/
./sbin/nginx -t

正常情况的信息输出:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

 

 5.启动nginx 

cd /usr/local/nginx/sbin
./nginx //启动nginx

浏览器输入服务器ip,证明成功

6.配置开机自启动

vim /etc/rc.d/rc.local

 

posted @ 2020-03-30 16:43  zhang_you_wu  阅读(2600)  评论(0编辑  收藏  举报