Linux的Nginx六:源码|安装
生活随笔
收集整理的這篇文章主要介紹了
Linux的Nginx六:源码|安装
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
源碼
概述
可以使用yum install tree來安裝tree命令,就可以顯示出文件的樹結構
可以看出共有10 directories, 265 files,Nginx的主要模塊是Core、event、http、mail、misc(雜項,包含多種功能)、os這幾個部分,并且根據源代碼的命名也可以大致的猜測出其所代表的功能。?
[root@iZ94sni08orZ nginx-1.8.0]# tree src/ src/ ├── core │ ├── nginx.c │ ├── nginx.h │ ├── ngx_array.c │ ├── ngx_array.h │ ├── ngx_buf.c │ ├── ngx_buf.h │ ├── ngx_conf_file.c │ ├── ngx_conf_file.h │ ├── ngx_config.h │ ├── ngx_connection.c │ ├── ngx_connection.h │ ├── ngx_core.h │ ├── (省略部分) │ ├── ngx_times.c │ └── ngx_times.h ├── event │ ├── modules │ │ ├── ngx_aio_module.c │ │ ├── ngx_devpoll_module.c │ │ ├── ngx_epoll_module.c │ │ ├── ngx_eventport_module.c │ │ ├── ngx_kqueue_module.c │ │ ├── ngx_poll_module.c │ │ ├── ngx_rtsig_module.c │ │ ├── ngx_select_module.c │ │ └── ngx_win32_select_module.c │ ├── ngx_event_accept.c │ ├── ngx_event.c │ ├── ngx_event_connect.c │ ├── ngx_event_connect.h │ ├── (省略部分) │ └── ngx_event_timer.h ├── http │ ├── modules │ │ ├── ngx_http_access_module.c │ │ ├── ngx_http_addition_filter_module.c │ │ ├── ngx_http_auth_basic_module.c │ │ ├── ngx_http_auth_request_module.c │ │ ├── ngx_http_autoindex_module.c │ │ ├── ngx_http_browser_module.c │ │ ├── ngx_http_charset_filter_module.c │ │ ├── ngx_http_chunked_filter_module.c │ ├── (省略部分) │ │ ├── ngx_http_uwsgi_module.c │ │ ├── ngx_http_xslt_filter_module.c │ │ └── perl │ │ ├── Makefile.PL │ │ ├── nginx.pm │ │ ├── nginx.xs │ │ ├── ngx_http_perl_module.c │ │ ├── ngx_http_perl_module.h │ │ └── typemap │ ├── ngx_http.c │ ├── ngx_http_cache.h │ ├── ngx_http_config.h │ ├── ngx_http_header_filter_module.c │ ├── (省略部分) │ ├── ngx_http_variables.h │ └── ngx_http_write_filter_module.c ├── mail │ ├── ngx_mail_auth_http_module.c │ ├── ngx_mail.c │ ├── (省略部分) │ ├── ngx_mail_ssl_module.c │ └── ngx_mail_ssl_module.h ├── misc │ ├── ngx_cpp_test_module.cpp │ └── ngx_google_perftools_module.c └── os└── unix├── ngx_aio_read.c├── ngx_aio_read_chain.c├── ngx_aio_write.c├── (省略部分)├── ngx_udp_recv.c├── ngx_user.c├── ngx_user.h└── ngx_writev_chain.c10 directories, 265 files編譯
1、為了支持rewrite功能,我們需要安裝pcre # yum install pcre* //如過你已經裝了,請跳過這一步2.安裝openssl 需要ssl的支持,如果不需要ssl支持,請跳過這一步# yum install openssl*3.gzip 類庫安裝 yum install zlib zlib-devel (注:如果是Ubuntu的話,直接使用命令sudo apt-get install nginx 進行下載即可)4、準備好源碼,進行解壓tar -zxvf nginx-1.8.0.tar.gz 5、編譯和安裝,執行如下命令: # cd nginx-1.8.0 # ./configure --prefix=/usr/local/nginx-1.7.0 \ --with-http_ssl_module --with-http_spdy_module \ --with-http_stub_status_module --with-pcre–with-http_stub_status_module:支持nginx狀態查詢 –with-http_ssl_module:支持https –with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持 –with-pcre:為了支持rewrite重寫功能,必須制定pcre(如果這里有提示還需要安裝其他的包,安裝即可)設置之后,執行make 結束之后執行 make install啟動命令在/usr/local/nginx-1.8.0/sbin文件下 啟動:./nginx 關閉:./nginx -s stop 重啟:./nginx -s reload?
總結
以上是生活随笔為你收集整理的Linux的Nginx六:源码|安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 股市macd代表什么意思
- 下一篇: Linux的Nginx七:对比|模块