[NGINX] ช่วยรวมชุดคำสั่ง 2 ไฟล์ ให้เป็นไฟล์เดียวหน่อยครับ

เริ่มโดย xmen256k, 28 สิงหาคม 2016, 02:48:40

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

xmen256k

ชุดคำสั่งแรก เป็นคำสั่งสำหรับการ caching ครับ
server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;

    location / {
        proxy_pass      http://%ip%:%web_port%;

        proxy_cache %domain%;
        proxy_cache_valid 15m;
        proxy_cache_valid 404 1m;
        proxy_no_cache $no_cache;
        proxy_cache_bypass $no_cache;
        proxy_cache_bypass $cookie_session $http_x_update;

        location ~* ^.+\.(%proxy_extentions%)$ {
            proxy_cache    off;
            root           %docroot%;
            access_log     /var/log/%web_system%/domains/%domain%.log combined;
            access_log     /var/log/%web_system%/domains/%domain%.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      http://%ip%:%web_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/nginx.%domain%.conf*;
}


ชุดคำสั่งสอง เป็นชุดคำสั่งสำหรับ wordpress ที่เอาไว้แก้ไขตรงจุดที่ nginx ไม่สามารถใช้งาน .htaccess ได้ครับ โดยแปลงให้สามารถใช้งานได้
server {
    listen      %ip%:%web_port%;
    server_name %domain_idn% %alias_idn%;
    root        %docroot%;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    %backend_lsnr%;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     %home%/%user%/conf/web/nginx.%domain%.conf*;
}



========================================


ผมก็เลยอยากจะรวบคำสั่งการ caching ไปใช้กับชุดคำสั่ง wordpress ด้วยครับ

ไม่ทราบว่าควรนำจุดไหน ไปใส่ไหนจุดไหนบ้าง

ขอบคุณครับ

nuonly

[direct=https://www.duduang.in.th]ดูดวง[/direct][direct=https://www.duduang.in.th]duduang[/direct] [direct=https://www.ddbaanteedin.com]ขายที่ดิน[/direct] [direct=https://www.ddbaanteedin.com/]ขายบ้าน[/direct]