隨筆 - 0, 文章 - 264, 評論 - 170, 引用 - 0
          數據加載中……

          linux安裝nginx

          1、下載nginx
          wget http://nginx.org/download/nginx-1.6.0.tar.gz

          2、解壓
          tar zxvf nginx-1.6.0.tar.gz
          進入nginx目錄,cd nginx-1.6.0

          3、配置
          ./configure

          配置過程中可能會報如下錯誤:
          checking for PCRE library  not found  
          checking 
          for PCRE library in /usr/local/  not found  checking for PCRE library in /usr/include/pcre/  not found  checking for PCRE library in /usr/pkg/  not found  checking for PCRE library in /opt/local/  not found    
          .
          /configure: error: the HTTP rewrite module requires the PCRE library.  You can either disable the module by using --without-http_rewrite_module  
          option, or install the PCRE library into the system, or build the PCRE library  
          statically from the source with nginx by using 
          --with-pcre=<path> option. 

          解決辦法,下載pcre庫,并編譯和安裝:
          PCRE庫是實現Perl正則表達式的基礎。如果系統中缺少此庫需要編譯安裝。可以從著名的開源軟件網站sourceforge上下載:
          http:
          //sourceforge.net/projects/pcre/files/pcre/。

          仍然是下載后解壓、配置、編譯和安裝:

          [
          ***]tar -zxvf pcre-8.35.tar.gz   

          [
          ***]cd pcre-8.35

          [
          ***]./configure  

          [
          ***]make  

          [
          ***]make install

          4、編譯與安裝nginx
          make

          make install

          5、啟動nginx
          /usr/local/nginx/sbin/nginx

          注:在64位系統上啟動時有可能報如下錯誤:
          Nginx: error while loading shared libraries: libpcre.so.1
          解決辦法如下:
          ln -s /usr/local/lib/libpcre.so.1 /lib64/libpcre.so.1

          再將啟動即可。

          6、查看是否啟動成功
          [root@localhost ~]# ps -aef | grep nginx
          root     
          28295     1  0 22:52 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
          nobody   
          28296 28295  0 22:52 ?        00:00:00 nginx: worker process      
          root     
          28615 28587  0 23:09 pts/0    00:00:00 grep nginx
          [root@localhost 
          ~]#
          啟動成功,master是主進程,關閉的時候kill這個進程,其他子進程會自動關掉

          打開瀏覽器http://localhost/ 即可看到nginx的默認歡迎頁
          Welcome to nginx!










          posted on 2014-05-12 23:13 小一敗涂地 閱讀(920) 評論(0)  編輯  收藏 所屬分類: linux相關nginx、squid、haproxy、varnish等

          主站蜘蛛池模板: 桦南县| 垦利县| 轮台县| 西充县| 桃源县| 海南省| 宁南县| 芜湖市| 剑阁县| 新平| 万山特区| 明星| 黎川县| 昭通市| 岳普湖县| 嵊州市| 全椒县| 衡水市| 平陆县| 兰坪| 宜州市| 宾阳县| 江津市| 营山县| 惠州市| 明溪县| 庐江县| 莫力| 老河口市| 临泽县| 新邵县| 班戈县| 平阴县| 县级市| 蒙阴县| 赤城县| 浮梁县| 平江县| 嵩明县| 水富县| 万州区|