<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # :-: 安裝nginx #### 1. 安裝依賴包 nginx依賴ssl,rewrite,gzip 3個包,如果沒有c++編譯環境需要用下面命令安裝。 `yum install gcc-c++` #### 2. 建立目錄 先在home目錄下建一個nginx文件夾。然后進入文件。(nginx、openssl、zlib、pcre直接下載到這個文件夾,解壓也是解壓到這個文件夾,都安裝好后直接刪除即可。) ~~~ cd home mkdir nginx cd nginx ~~~ #### 3. openssl庫安裝 ssl功能需要安裝openssl庫 ,官網:https://www.openssl.org。建立文件夾/alidata/library/做為這3個庫的安裝目錄。統一放一個文件夾,日后如果想卸載,直接刪除就可以。在library下面再建立openssl、zlib、pcre三個文件夾。做為那3個庫的安裝目錄。 ~~~ wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz tar -zxvf openssl-1.1.0g.tar.gz cd openssl-1.1.0g ./config --prefix=/alidata/library/openssl &amp;&amp; make &amp;&amp; make install ~~~ #### 4. 安裝zlib庫 gzip模塊需要安裝zlib庫,官網:http://www.zlib.net。(axel -n 后面的10是一次性建立10個連接下載) ~~~ axel -n 10 http://www.zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure --prefix=/alidata/library/zlib &amp;&amp; make &amp;&amp; make install ~~~ #### 5. 安裝pcre庫 rewrite模塊需要pcre庫,官網:http://www.pcre.org。 ~~~ axel -n 10 https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz tar -zxvf pcre-8.41.tar.gz cd pcre-8.41 ./configure --prefix=/alidata/library/pcre &amp;&amp; make &amp;&amp; make install ~~~ #### 6. nginx的編譯安裝 下載nginx,nginx的官網是http://nginx.org/。我們直接下載最新版本的nginx-1.13.7。在/alidata下建立server,然后在server下面分別建立nginx、mysql、php。后面會分別把對應的軟件安裝到這幾個文件夾里。(--prefix:nginx的安裝目錄 ,--with-pcre:pcre的源碼目錄,--with-zlib和--with-openssl同理) ~~~ axel -n 10 http://nginx.org/download/nginx-1.13.7.tar.gz tar -zxvf nginx-1.13.7.tar.gz cd nginx-1.13.7 ./configure \ --prefix=/alidata/server/nginx \ --with-http_realip_module \ --with-http_sub_module \ --with-http_flv_module \ --with-http_dav_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_addition_module \ --with-pcre=/home/nginx/pcre-8.41 \ --with-openssl=/home/nginx/openssl-1.1.0g \ --with-http_ssl_module \ --with-zlib=/home/nginx/zlib-1.2.11 &amp;&amp; make &amp;&amp; make install ~~~ ![](https://box.kancloud.cn/f12e32e64d49d4f1d179bdc823bec954_1918x1013.png =770x400) ![](https://box.kancloud.cn/e7c94bc0d57782c88cfc126595277657_1917x1009.png =770x400) ![](https://box.kancloud.cn/fb769711a6d0b36e6d4a4088458c0dff_778x725.png) ![](https://box.kancloud.cn/9b2e99afc01e42595a1635ebe932697e_780x161.png) ![](https://box.kancloud.cn/afe787b404b2de4f9441a19b62b09621_779x136.png) #### 7. 檢查nginx是否安裝成功 檢查nginx是否安裝成功,如果出現下圖信息,表示安裝成功。 ~~~ cd /alidata/server/nginx/sbin ./nginx -t ~~~ ![](https://box.kancloud.cn/865ea7eb8cc66c6a957c3adeeec56ab6_780x104.png) ![](https://box.kancloud.cn/e07c544ac1f0b30823eeca19b2febc08_780x309.png) #### 8. 常用命令 nginx的幾個常用命令: 查看Nginx的版本號:./nginx -v 啟動Nginx:./nginx 快速停止或關閉Nginx:./nginx -s stop 正常停止或關閉Nginx:./nginx -s quit 配置文件修改重裝載命令:./nginx -s reload #### 9. 將nginx加入系統命令 vi /etc/init.d/nginx 加入下面代碼 ~~~ #!/bin/bash #nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: - 85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it&#039;s not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/alidata/server/nginx/sbin/nginx nginx_config=/alidata/server/nginx/conf/nginx.conf nginx_pid=/alidata/server/nginx/run/nginx.pid RETVAL=0 prog=&quot;nginx&quot; # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ [${NETWORKING} = &quot;no&quot;] ] &amp;&amp; exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo &quot;nginx already running....&quot; exit 1 fi echo -n $&quot;Starting $prog: &quot; daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] &amp;&amp; touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $&quot;Stopping $prog: &quot; killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] &amp;&amp; rm -f /var/lock/subsys/nginx /alidata/server/nginx/run/nginx.pid } # reload nginx service functions. reload() { echo -n $&quot;Reloading $prog: &quot; #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case &quot;$1&quot; in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $&quot;Usage: $prog {start|stop|restart|reload|status|help}&quot; exit 1 esac exit $RETVAL ~~~ 保存上面的代碼。然后添加到系統服務中。 ~~~ chmod 755 /etc/init.d/nginx chkconfig --add nginx ~~~ #### 10. 在系統服務目錄中創建nginx.service文件 `vi /lib/systemd/system/nginx.service` 加入下面的代碼 ~~~ [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/alidata/server/nginx/sbin/nginx ExecReload=/alidata/server/nginx/sbin/nginx -s reload ExecStop=/alidata/server/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target ~~~ 保存。再執行重加載 `systemctl daemon-reload` 設置開機啟動 `systemctl enable nginx.service` ![](https://box.kancloud.cn/139d1bd6272fe6d138cf0c0f6d9c9e89_780x274.png) #### 10. nginx服務命令 配置好之后nginx就可以用系統服務的方式操作了。 service nginx start 啟動nginx service nginx stop 關閉nginx service nginx restart 重啟nginx service nginx reload 重新加載nginx ![](https://box.kancloud.cn/e22dda5676007bb140f50fb61060bf6d_779x150.png) ![](https://box.kancloud.cn/c257016fd720ebc8d2056812d64c2bae_1917x446.png =770x180)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看