Linux 安装nginx
2018-04-08 本文已影响0人
lihao_李浩
进入:/usr/java/nginx位置
cd ~
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
wget http://zlib.net/fossils/zlib-1.2.8.tar.gz
wget https://github.com/lihhhh/download/raw/master/nginx/pcre-8.38.tar.gz
yum install gcc-c++
cd ~
tar zxvf openssl-fips-2.0.9.tar.gz
cd openssl-fips-2.0.9
./config && make && make install
cd ~
tar zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure && make && make install
cd ~
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure && make && make install
cd ~
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
yum -y install openssl openssl-devel
./configure --with-http_ssl_module && make && make install
启动nginx
/usr/local/nginx/sbin/nginx
出现错误提示
[root@localhost lib]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
原因 在RedHat 64位机器上nginx读取的pcre文件为/lib64/libpcre.so.1文件,默认安装pcre时libpcre.so文件安装在/usr/local/lib/目录下,所以输入/opt/nginx/sbin/nginx -V 找不到文件路径!!
[root@localhost] ln -s /usr/local/lib/libpcre.so.1 /lib64/
然后再启动/usr/local/nginx/sbin/nginx
应该就ok了
测试访问服务器ip 不用加端口号:
image.png