centos7(minirnal)版安装——nginx

1、安装好centos7 已经配置好网卡。

2、关闭centos7 的防火墙

参加:

http://blog.csdn.net/shen1936/article/details/39696953

3、下载nginx,并上传到Linux中

http://nginx.org/en/download.html

4、安装

[root@localhost opt]# ls
nginx-1.7.5.tar.gz
[root@localhost opt]# tar zxvf nginx-1.7.5.tar.gz 

[root@localhost nginx-1.7.5]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

查看 configure的依赖包,并安装

[root@localhost nginx-1.7.5]# yum install ./configure 

[root@localhost nginx-1.7.5]# yum install gcc


可以通过执行 configure 来进行编译安装

[root@localhost nginx-1.7.5]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@localhost nginx-1.7.5]# cd /home/
[root@localhost home]# ls
[root@localhost home]# mkdir nginx
[root@localhost home]# cd /opt/
[root@localhost opt]# cd nginx-1.7.5
[root@localhost nginx-1.7.5]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
<pre name="code" class="plain">[root@localhost nginx-1.7.5]# ./configure --prefix=/home/nginx/

 在执行过程中出错 

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

还是缺少包,解决办法
将包安装好后,继续上一个命令

[root@localhost nginx-1.7.5]# ./configure --prefix=/home/nginx/
结果

Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + md5: using system crypto library
  + sha1: using system crypto library
  + using system zlib library

  nginx path prefix: "/home/nginx/"
  nginx binary file: "/home/nginx//sbin/nginx"
  nginx configuration prefix: "/home/nginx//conf"
  nginx configuration file: "/home/nginx//conf/nginx.conf"
  nginx pid file: "/home/nginx//logs/nginx.pid"
  nginx error log file: "/home/nginx//logs/error.log"
  nginx http access log file: "/home/nginx//logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

make && make install

安装完成,启动nginx

[root@localhost nginx-1.7.5]# cd /home/nginx/
conf/ html/ logs/ sbin/ 
[root@localhost nginx-1.7.5]# cd /home/nginx/
[root@localhost nginx]# ls
conf  html  logs  sbin
nginx的启动目录程序放在sbin下

[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ./nginx 

查看是否启动

[root@localhost sbin]# ps -ef |grep nginx
root      6998     1  0 23:07 ?        00:00:00 nginx: master process ./nginx
nobody    6999  6998  0 23:07 ?        00:00:00 nginx: worker process
root      7003  2320  0 23:08 pts/1    00:00:00 grep --color=auto nginx


启动完成,可以输入IP浏览下









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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值