码迷,mamicode.com
首页 > 系统相关 > 详细

linux系统安装nginx

时间:2019-05-24 10:57:50      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:linux   ram   系统安装   failed   usr   min   open()   col   编译   

 

centos平台编译环境使用如下指令

  安装make:

yum -y install gcc automake autoconf libtool make

  安装g++:

yum install gcc gcc-c++

 

一、选定安装文件目录

cd /usr/local/src

  

二、安装PCRE库

cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz 
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.34
./configure
make
make install

三、安装zlib库

cd /usr/local/src
 
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install

四、安装openssl(某些vps默认没装ssl)

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
tar -zxvf openssl-1.0.1t.tar.gz

五、安装nginx

cd /usr/local
wget http://nginx.org/download/nginx-1.1.10.tar.gz
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure
make
make install

六、加载nginx.conf报错

./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

ln -s /usr/local/lib/libpcre.so.1 /lib64

七、加载nginx.conf配置

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

如果报错

nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory)
2019/05/24 17:55:48 [emerg] 22236#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)

1.在nginx下创建logs目录

2.在logs目录下创建access.log文件和error.log文件

再执行下加载nginx.conf的命令

 

八、启动nginx(sbin目录)

./nginx -s reload

安装完成

linux系统安装nginx

标签:linux   ram   系统安装   failed   usr   min   open()   col   编译   

原文地址:https://www.cnblogs.com/FHLadmin/p/10916500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!