`
yaozhiqiang109
  • 浏览: 117550 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Nginx安装详解

阅读更多

nginx安装

1、rpm -qa | grep gcc  检查是否安装了g++、gcc

2、yum install gcc-c++

3、下载pcre2-10.22.tar.gz和nginx-1.8.1.tar.gz

4、tar zxvf pcre2-10.22.tar.gz

5、cd pcre2-10.22

6、./configure

7、make

8、make install

 

9、创建用户nginx使用的www用户

groupadd  www  #添加www组

useradd -g  www www -s /bin/false  #创建nginx运行账户www并加入到www组,不允许www用户直接登录系统

10、创建nginx日志目录

chown www:www /logs/nginx -R

11、安装zlib-devel,如已安装可略过  yum install -y zlib-devel

12、解压nginxtar zxvf nginx-1.8.1.tar.gz

13、cd nginx-1.8.1

14、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module

15、./configure: error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题   yum -y install pcre-devel

16、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module

17、./configure: error: the HTTP cache module requires md5 functions from OpenSSL library. 

安装yum -y install openssl openssl-devel解决

18、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module

19、make

20、make install

21、检查是否安装成功

cd  /usr/local/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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics