欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
nginx的簡(jiǎn)介,安裝和簡(jiǎn)單配置

nginx

  

轉載請注明原文鏈接:http://blog.csdn.net/omohe/archive/2009/07/09/4335763.aspx

版本:v1.0  作者:OMO 最后修改時(shí)間:2009.07.09

0. nginx在實(shí)際中使用:
之前我們介紹了使用nginx可以完全作為web app server來(lái)使用,代替Apache;
另外也可以單單使用nginx作為反向代理服務(wù)器來(lái)實(shí)現Server Cluster。


1. nginx的基礎知識:
參考http://en.wikipedia.org/wiki/Nginx
http://wiki.nginx.org/Main
http://www.nginx.org/
簡(jiǎn)單來(lái)說(shuō),精華在于:HTTPServer或者reverse proxy
另外需要注意它和ApacheServer的不同,Unlike traditional servers, Nginx doesn't relyon threads to handle requests. Instead it uses a much more scalableevent-driven (asynchronous) architecture. This architecture uses small,but most importantly, predictable amounts of memory under load.
Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers.
另外,更多的功能可以通過(guò)模塊進(jìn)行擴展。

2. nginx的安裝:
具體可以參考:http://wiki.nginx.org/Main( 支持Windows和Linux等多種OS)
1) 源代碼安裝很簡(jiǎn)單:可以按照默認的./configure,然后make和make install
輸入./configure --help可以配置需要編譯的各種模塊,

如果日后需要加入某個(gè)模塊的話(huà),需要重新編譯,具體:
make clean,然后./configure+新的配置選項, make, make install。

難點(diǎn)是如何理解nginx服務(wù)器的配置,位于安裝目錄的nginx.conf文件。
總之需要知道的是:具體如何配置決定于準備使用nginx實(shí)現什么功能,例如最簡(jiǎn)單的單單是個(gè)反向代理服務(wù)器,或者作為一個(gè)http server來(lái)使用。各種具體應用和配置可以參看一下:
    "Typical Configurations Overview For Nginx HTTP(S) Reverse Proxy/Web Server":
    http://blog.kovyrin.net/2006/04/17/typical-nginx-configurations/
更多詳情參看關(guān)于如何配置的教程:
    http://wiki.nginx.org/NginxConfiguration

默認安裝到/usr/local/nginx,具體啟動(dòng)的時(shí)候需要到bin目錄下執行sudo ./nginx;
要終止nginx可以查看位于logs目錄下的pid,然后kill pid即可;
   
2) 如果是二進(jìn)制包安裝的話(huà):
首先搜搜看apt-cache search nginx
然后安裝sudo apt-get install nginx
Ubuntu下查看默認安裝的位置,可以使用whereis nginx
nginx和Apache類(lèi)似都是通過(guò)module方式對各種功能進(jìn)行擴展,關(guān)于nginx更多信息可以參看如上的鏈接。

3) Windows下的二進(jìn)制安裝非常簡(jiǎn)單:
直接下載,解壓縮到C:/根目錄下即可.
具體參看:http://wiki.nginx.org/NginxInstall
nginx -s [ stop | quit | reopen | reload ]

3. nginx的配置:
上面介紹了,首先nginx和Apache類(lèi)似通過(guò)各種模塊module可以對服務(wù)器的功能進(jìn)行豐富的擴展。同樣也是類(lèi)似通過(guò)nginx.conf文件可以對進(jìn)行核心配置或者針對各種模塊的配置。
http://wiki.nginx.org/NginxModules
具體如何配置通常還是取決于,準備使用nginx來(lái)做什么,幾個(gè)很好的關(guān)于配置的參考資料:
http://blog.kovyrin.net/2006/04/17/typical-nginx-configurations/
http://wiki.nginx.org/NginxConfiguration

0) 首先我們展示一下默認的nginx.conf文件中各個(gè)部分:
nginx.conf配置文件中,針對不同的模塊使用大括號包括起來(lái),很方便地進(jìn)行配置;
一個(gè)非常好的教程可以參看:
http://wiki.nginx.org/NginxModules

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #這里表示設置該server的root根目錄是nginx安裝目錄的html目錄,當然可以設置絕對路徑
        location / {
            root   html;
            autoindex    on; #開(kāi)啟自動(dòng)列出目錄文件功能,如果找不到index頁(yè)面的話(huà)。
            index  index.html index.htm; #設置默認的首頁(yè)
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        #這里是一個(gè)很好的nginx作為反向代理服務(wù)的設置,表示遇到php結尾的,會(huì )自動(dòng)pass給后臺偵聽(tīng)的apache或者別的服務(wù)器;
        #proxy the PHP scripts to Apache listening on 127.0.0.1:80
        location ~ \.php$ {
            proxy_pass   http://127.0.0.1 ;
        }
       
        #如果安裝了FastCGI,則將其pass給FastCGI,這個(gè)說(shuō)明了nginx本身不包裹FastCGI處理器,而是僅僅通過(guò)如下的方式pass給預先安裝的FastCGI server,具體PHP的FastCGI如何安裝,可以參看相關(guān)教程。
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000 ;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    #nginx的虛擬主機情況支持多種類(lèi)型name-based(多個(gè)網(wǎng)站ip相同,域名不同),ip-based(多個(gè)網(wǎng)站ip不同)
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    #提供SSL認證的server配置
    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

下面我們來(lái)簡(jiǎn)單介紹各種使用nginx的情況:
可以參考http://blog.kovyrin.net/2006/04/17/typical-nginx-configurations/
1)默認安裝的nginx配置文件中listen       80;
表示偵聽(tīng)80端口的HTTP請求,如果預先安裝了Apache的話(huà),就會(huì )占用該端口,從而使得Apache無(wú)法使用。
默認的配置提供對各種靜態(tài)文件的訪(fǎng)問(wèn);
2)nginx作為反向代理服務(wù)器使用
如上面的配置,
        #proxy the PHP scripts to Apache listening on 127.0.0.1:80
        location ~ \.php$ {
            proxy_pass   http://127.0.0.1 ;
        }
我們可以設置所有對php script腳本的請求,都proxy_pass到后臺偵聽(tīng)的web server服務(wù)器(例如apache)等。
nginx還提供了一些模塊例如Memcached,或者結合Squid等可以實(shí)現pass到后臺web server相應之后,對返回的數據進(jìn)行cache,從而提供性能。

這個(gè)相當于使用nginx作為apache的前端,可以看看這個(gè)教程:
http://sameerparwani.com/posts/nginx-as-a-front-end-to-apache/
常見(jiàn)的情況是,使用nginx直接處理靜態(tài)的請求響應;對于動(dòng)態(tài)的才pass給服務(wù)器,而且對服務(wù)器的響應結果進(jìn)行緩存。

3)nginx做為多臺server的負載均衡作用:
http://sameerparwani.com/posts/load-balancing-with-nginx/

4)另外一個(gè)常見(jiàn)的應用就是直接使用nginx代替了Apache,使用Linux+Nginx+MyQL+PHP的stack。
這個(gè)時(shí)候首先需要以FastCGI的方式安裝PHP(需要一個(gè)FastCGI的process server),然后配置nginx支持PHP。
具體參考相關(guān)的專(zhuān)題介紹。

5)更多的配置介紹參看
http://wiki.nginx.org/NginxModules
各個(gè)模塊的配置和configure教程。
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Windows下Nginx的安裝與配置
大型架構.net平臺篇(WEB層均衡負載nginx)
nginx在WIN下的配置和安裝 .
Nginx主配置參數詳解,Nginx配置網(wǎng)站
centOS7安裝nginx及nginx配置
NGINX配置多域名
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久