Nginx安装步骤

DogJay 2018-09-23 系统运维 642人已围观

## 安装nginx依赖环境: ##

```shell yum -y install gcc gcc-c++ autoconf automake libtool make install zlib zlib-devel openssl openssl-devel pcre pcre-devel ``` ## 安装nginx ## 1.上传源码包(见附件nginx installer.zip)至主机并解压,解压后结构如下: ```shell [root@iZ2ze1ddjnioyoipm3u5voZ ~]# ll total 174840 -rw-r--r-- 1 root root 170023183 Sep 23 17:31 jdk-8u181-linux-x64.rpm drwxr-xr-x 9 apps apps 4096 Sep 23 17:46 nginx-1.14.0 -rwxr-xr-x 1 root root 1016272 Sep 23 17:44 nginx-1.14.0.tar.gz drwxr-xr-x 19 root root 4096 Sep 23 17:48 openssl-1.1.0f -rwxr-xr-x 1 root root 5278176 Sep 23 17:44 openssl-1.1.0f.tar.gz drwxr-xr-x 9 1169 1169 12288 Sep 23 17:48 pcre-8.41 -rwxr-xr-x 1 root root 2068775 Sep 23 17:44 pcre-8.41.tar.gz drwxr-xr-x 14 501 games 4096 Sep 23 17:48 zlib-1.2.11 -rwxr-xr-x 1 root root 607698 Sep 23 17:44 zlib-1.2.11.tar.gz ``` 2.进入nginx-1.14.0目录,执行以下命令安装: ```shell ./configure --user=root --group=root --prefix=/etc/nginx --sbin-path=/bin --conf-path=/etc/nginx/conf/nginx.conf --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-threads --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.0f --with-pcre=../pcre-8.41 make && make install ``` 3.安装完毕后查看/etc/nginx目录,是否如下结构: ```shell [root@iZ2ze1ddjnioyoipm3u5voZ ~]# cd /etc/nginx/ [root@iZ2ze1ddjnioyoipm3u5voZ nginx]# ll total 32 drwx------ 2 root root 4096 Sep 23 17:51 client_body_temp drwxr-xr-x 3 root root 4096 Sep 23 18:18 conf drwx------ 2 root root 4096 Sep 23 17:51 fastcgi_temp drwxr-xr-x 2 root root 4096 Sep 23 17:48 html drwxr-xr-x 2 root root 4096 Sep 23 17:51 logs drwx------ 12 root root 4096 Sep 23 18:18 proxy_temp drwx------ 2 root root 4096 Sep 23 17:51 scgi_temp drwx------ 2 root root 4096 Sep 23 17:51 uwsgi_temp ``` 4.进入/usr/sbin目录,执行以下命令: ```shell ln -s /bin/nginx nginx ``` 5.执行命令nginx -V,控制台是否显示如下: ```shell [root@iZ2ze1ddjnioyoipm3u5voZ nginx]# nginx -v nginx version: nginx/1.14.0 ``` 附件:点我下载

吐槽(0)

文章评论

    共有0条评论

    验证码:

文章目录