在finalshell中如何安装nginx

一、先下载nginx

nginx newsicon-default.png?t=N176http://nginx.org/ 使⽤的版本是1.8.0版本。

二、配置yum源为阿里云(这一步可配可不配)。

 1、cd /etc/yum.repos.d/
 2、备份⼀下:cp CentOS-Base.repo CentOS-Base.repo.bak
 3、下载阿⾥云镜像到本地:
 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
 4、清除yum的缓存
 yum clean all
 yum makecache

三、安装环境

yum install -y gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel

四、上传

cd /home/

mkdir software

cd software

五、解压

tar -zxvf nginx-1.8.0.tar.gz

六、使⽤configure命令创建⼀makeFile⽂件

先把没有的文件夹创建出来:

mkdir -p /var/temp/nginx/client

进入的nginx目录:
cd 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 \
--with-http_stub_status_module

八、

1、make

2、make install

九、验证是否成功

1、cd /usr/local/nginx

2、ll

十、启动nginx

1、cd sbin (注不要打 cd /sbin

2、启动:./nginx

3、启动后查看是否有nginx: ps -aux | grep nginx

root      52684  0.0  0.0  24896   768 ?        Ss   13:12   0:00 nginx: master process ./nginx
nobody    52685  0.0  0.0  25324  1456 ?        S    13:12   0:00 nginx: worker process
root      53227  0.0  0.0 112824   984 pts/0    R+   13:13   0:00 grep --color=auto nginx

查看到有两个进程:master  worker

十一、访问Nginx的web页面:

注:ip地址是自己的ip不要打我的

如果防火墙忘记关闭,是访问不了网址的。Nginx的默认端口是80。

补充:nginx的操作

关闭nginx:
./nginx -s stop
 推荐使⽤:
./nginx -s quit
 刷新(重启)配置⽂件:
./nginx -s reload

 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值