nginx安装部署
1、下载Nginx及相关组件
wget http://nginx.org/download/nginx-1.10.2.tar.gz

wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz

wget http://zlib.net/zlib-1.2.11.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz

2、安装c++环境
yum install gcc-c++

期间会有确认提示输入y回车

2、安装Nginx及相关组件
1、安装openssl
tar zxvf openssl-fips-2.0.10.tar.gz

cd openssl-fips-2.0.10

./config && make && make install

在安装openssl时需要安装Perl5,否则报一下错误。
Operating system: x86_64-whatever-linux2 You need Perl 5.
https://blog.csdn.net/warylee/article/details/84628345
3、安装pcre
tar zxvf pcre-8.40.tar.gz

cd pcre-8.40
./configure && make && make install

4、安装zlib
tar zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure && make && make install

5、安装nginx
tar zxvf nginx-1.10.2.tar.gz

cd nginx-1.10.2

yum -y install openssl openssl-devel

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

make && make install

3、启动nginx
找一下nginx安装到什么位置

Whereis nginx

进入nginx目录并启动
cd sbin
执行
./nginx

如果报错了,error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory,按照下面方式解决

1.用whereis libpcre.so.1命令找到libpcre.so.1在哪里
2.用ln -s /usr/local/lib/libpcre.so.1 /lib64命令做个软连接就可以了

3.用sbin/nginx启动Nginx

4.用ps -aux | grep nginx查看状态

打开浏览器输入localhost 显示下图则成功

nginx安装配置

启动
nginx/sbin/nginx

停止/重启
nginx/sbin/nginx -s stop(quit、reload)

命令帮助
nginx/sbin/nginx -h

验证配置文件
nginx/sbin/nginx -t

配置文件
vim nginx/conf/nginx.conf

相关文章: