linux下nginx的简单安装

292 阅读1分钟

相关软件包请自行下载:

  • zlib-1.2.8.tar.gz
  • pcre-8.38.tar.gz
  • nginx-1.15.2.tar.gz

(1)安装zlib,进入到nginxTool目录

[root@localhost nginxTool]# tar -zxvf zlib-1.2.8.tar.gz
[root@localhost nginxTool]# cd zlib-1.2.8
[root@localhost zlib-1.2.8]# ./configure 
[root@localhost zlib-1.2.8]# make
[root@localhost zlib-1.2.8]# make install

(2)安装pcre

[root@localhost nginxTool]# tar -zxvf pcre-8.38.tar.gz
[root@localhost nginxTool]# cd pcre-8.38
[root@localhost pcre-8.38]# ./configure 
[root@localhost pcre-8.38]# make
[root@localhost pcre-8.38]# make install

(3)安装Nginx

[root@localhost nginxTool]# tar -zxvf nginx-1.15.2.tar.gz 
[root@localhost nginxTool]# cd nginx-1.15.2
[root@localhost nginx-1.15.2]# ./configure --with-pcre=../pcre-8.38 --with-zlib=../zlib-1.2.8
[root@localhost nginx-1.15.2]# make
[root@localhost nginx-1.15.2]# make install

(4)nginx安装的目录:/usr/local/nginx

(5)启动nginx(指定配置文件启动)

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

(6)访问http://IP地址,如果访问不了,请检查80端口是开放