亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.430618.com 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

  • Nginx配置文件詳解
#啟動子進程程序默認用戶
#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服務器設置
http {
    #設定mime類型,類型由mime.type文件定義
    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"';
    #$remote_addr與$http_x_forwarded_for用以記錄客戶端的ip地址;
    #$remote_user:用來記錄客戶端用戶名稱;
    #$time_local: 用來記錄訪問時間與時區;
    #$request: 用來記錄請求的url與http協議;
    #$status: 用來記錄請求狀態;成功是200,
    #$body_bytes_sent :記錄發送給客戶端文件主體內容大小;
    #$http_referer:用來記錄從那個頁面鏈接訪問過來的;
    #$http_user_agent:記錄客戶瀏覽器的相關信息;

    #全局訪問日志路徑 
    #access_log  logs/access.log  main;
    #sendfile指令指定 nginx 是否調用sendfile 函數(zero copy 方式)來輸出文件,對于普通應用,必須設為on。如果用來進行下載等應用磁盤IO重負載應用,可設置為off,以平衡磁盤與網絡IO處理速度,降低系統uptime。
    sendfile        on;

    #此選項可以減少網絡報文段的數量
    #tcp_nopush     on;

    #長連接超時時間
    #keepalive_timeout  0;
    keepalive_timeout  65;

    #開啟壓縮
    #gzip  on;

    #配置虛擬主機
    server {
        #虛擬主機使用的端口
        listen       80;
        #虛擬主機域名
        server_name  localhost;

        #虛擬主機支持的字符集
        #charset koi8-r;

        #虛擬主機的訪問日志路徑
        #access_log  logs/host.access.log  main;

        #定義web根路徑
        location / {
            #根目錄路徑
            root   html;
            #索引頁
            index  index.html index.htm;
        }

        #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;
        }

        #定義反向代理服務器 數據服務器是lamp模型
        # proxy the php scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}


        #定義PHP為本機服務的模型  
        # 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
        #
        #拒絕nginx DR目錄及子目錄下的.htaccess文件訪問
        #location ~ /.ht {
        #    deny  all;
        #}
    }


    # 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;
    #    }
    #}


    #https的配置方案
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

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

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

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

}

總結

nginx的主配置文件

重點:nginx的主配置文件中的字段含義及格式

難點:修改時注意格式問題

分享到:
標簽:nginx
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定