• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
车车大人
博客园    首页    新随笔    联系   管理     

linux安装nginx

一. nginx是什么?
1)Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件代理服务器,并在一个BSD-like 协议下发行。
2)特点: 占有内存少, 并发能力强 , 事实上nginx的并发能力确实在同类型的网页服务器中表现较好。

1.安装前准备:

#首先确认是不是有安装编译包和一些依赖包
# yum install gcc gcc-c++ openssl openssl-devel zib-devel zib

2.安装pcre
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
#tar zxvf pcre-8.39.tar.gz
编译安装
# cd pcre-8.39
# ./configure --prefix=/usr/local/pcre 
# make && make install

3.安装nginx
# wget http://nginx.org/download/nginx-1.6.2.tar.gz
# tar -zxvf nginx-1.6.2.tar.gz
# cd nginx-1.6.2
# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre --with-http_stub_status_module
# make && make install

 

注意了注意了,标黄的地方是说pcre解压后的源码路径,不是安装目录

5.启动nginx
检查nginx配置文件语法有没问题
#/usr/local/nginx/sbin/nginx -t
如果没有会出现,下面提示
nginx: the configuration file /usr/local/nginx-1.4.6/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx-1.4.6/conf/nginx.conf test is successful

启动nginx
#/usr/local/nginx/sbin/nginx

 

重新加载nginx
#/usr/local/nginx/sbin/nginx –s reload

到这一步没有什么错误,就可以ip访问了.

 

 

配置nginx开机自启

vi /etc/rc.local

 

保存并退出,然后执行

chmod 755 /etc/rc.local

 

二.安装中报错解决:

1.解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误 

解决方法:
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

2.解决 ./configure: error: the HTTP rewrite module requires the PCRE library.

#yum -y install pcre-devel

以上仅为个人安装,仅供参考!

通往牛逼的路上,在意的只有远方!
posted @ 2018-01-18 16:40  车车大人  阅读(308)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3