แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - golfreeze

Pages: 1 ... 62 63 [64] 65 66 ... 73
946
Music for relax / สาป ธีร์ ไชยเดช
« on: กรกฎาคม 15, 2011, 10:03:12 AM »
สาป

ศิลปิน : ธีร์ ไชยเดช

InTRo : Dmaj7/Em7 (4Time)

Dmaj7 Em7 Dmaj7 Em7
คบเธอมานานจนเผลอไป รักจนล้นใจ

Dmaj7 Em7 Dmaj7 Em7
รักเธอมานานจนฝันไป ว่าเธอคงมีใจ

G Dmaj7
ไม่ว่าเขาจะเป็นยังไง เขาจะดีแค่ไหน

G Dmaj7
เขาจะเป็นยังไงเธอก็รักฉัน

G Dmaj7
ฝันถึงวันดีดี ที่เรามีกันและกัน

Em7 A
แม้จะมีเพียงวันที่ฉันฝันไป

Dmaj7 Em7 Dmaj7 Em7
รู้ว่าต้องทำใจรักไป ปล่อยใจได้คุ้นเคย

Dmaj7 Em7 Dmaj7 Em7
รู้ว่าต้องทำใจเฉยเมย ไม่เคยได้เอื้อนได้เอ่ยจนหมดใจ

G Dmaj7
* ไม่ว่าฉันจะเป็นยังไง ฉันจะดีแค่ไหน

G Dmaj7
ฉันจะเป็นยังไงเธอก็เลือกเขา

G Dmaj7
ฝันถึงวันดีดี ที่เรามีกันสองเรา

Em7 A
แม้จะเป็นเพียงเราที่ฉันฝันไป



G Dmaj7
** ฉันโดนสาปมาให้รักเธอ

G Dmaj7
วันที่เธอนั้นได้รักเขา

G F#m7
ใจโดนสาปให้ล่องตามเหมือนเงา

Em A Dmaj7 Em7 Dmaj7 Em7
แอบอิงเธอบางเบา กระซิบฟังเบาๆว่าฉันรักเธอ

SOLO : Dmaj7/Em7 (2 times)

(ซ้ำ * / **)

Dmaj7 Em7 Dmaj7 Em7 Dmaj7

947
Music for relax / หยุด [groove]
« on: กรกฎาคม 15, 2011, 10:02:27 AM »
           Cmaj7        Bm7
ฉันนั่งยิ้มลำพัง หัวเราะลำพัง
   Am7         D7     Gmaj7
สุขยิ่งกว่าทุกครั้งที่ผ่านมา
             Cmaj7
ตั้งแต่ได้พบกับเธอนั้น
         Bm7                Am7       D7        Gmaj7
เรื่องจริงกับความฝัน เกิดขึ้นด้วยกันทันตา
 
Em7                         A
*ฉันอยากจะหยุดเวลานี้
Em7                  A
ตั้งแต่วินาที ที่ชีวิตมีเธอเข้ามา
Em7                         A          D7
เธอทำให้คนที่เหนื่อยล้า นั้นกล้าจะเปิดหัวใจ
 
Cmaj7                    Bm7
**หยุด หยุดชีวิต หยุดกับคนนี้
Am7          D7      Gmaj7
แม้ว่าใครจะดีซักแค่ไหน
Cmaj7                    Bm7
หยุด หยุดความรัก ทั้งหัวใจ
     Am7         D7       Gmaj7
จะหยุดอยู่กับเธอคนเดียว
 
         Cmaj7        bm7
ฉันนั้นรู้ทันที และรักทันที
      Am7           D7       Gmaj7
เธอคือความโชคดีที่เข้ามา
                Cmaj7
ตั้งแต่ได้พบกับเธอนั้น
 Bm7                        Am7      D7       Gmaj7
ชีวิตเหมือนความฝันที่เกิดขึ้นตอนลืมตา
 
( ซ้ำ *,** )
(ดนตรี) Cmaj7/Bm7/Am7/D7/Gmaj7/ ( 2 times )
            Em/A7/Em/A7/Em/A/D7/D7
 
(ซ้ำ **,**,**,**)

948
Music for relax / คำถามโง่ๆ
« on: กรกฎาคม 03, 2011, 04:18:00 PM »
คำถามโง่ๆ


949
Music for relax / ฉันดีใจที่มีเธอ ^^
« on: กรกฎาคม 03, 2011, 03:39:16 PM »
G/Am/Bm/C
        Em                                       Bm
ในโลกที่มี ความวกวน              ในโลกที่ทุกคนต้องดิ้นรน
         C                                              G
ที่สับสน ร้อนรนจนใจ นั้นแสนเหนื่อย
        Em                                    Bm
ในโลกที่ความทุกข์ท้อใจ           ได้เดินผ่านเข้ามาเรื่อยๆ
           C                         D
 จนบางครั้งไม่รู้จะข้ามไปเช่นไร
          Em        Bm
* แต่ยิ่งชีวิต ยิ่งผ่าน ยิ่งได้พบ ยิ่งเจอ
          Am            D
กลับทำให้ฉันยิ่งคิด ในใจ  
   G                    C                        
** ฉันดีใจทีมีเธอ ฉันดีใจที่เจอเธอ
              Bm       C                     
เธอคือกำลังใจเดียวที่มี ไม่ว่านาทีไหนๆ
                 G                      D              
ฉันดีใจที่มีเธอ แม้จะต้องพบ อะไร    (แม้จะไม่เหลือใครใคร)
      C                        
และฉันรู้และฉันอุ่นใจ
Cm   D     G         Am/Bm/C
ว่าฉันนั้นจะมีเธออยู่ ตรงนี้                ฮือ....
        Em                                       Bm
ในอุปสรรค ที่มากมาย        ในความหวาดหวั่น ที่วุ่นวาย
         C                               G
 และอนาคต ในปัจจุบัน และ อดีต
               Em                                    Bm
ในความเจ็บปวดที่ต้องเจอ          ที่ไม่เคยคุ้นเลยสักที
          C                           D
แต่ยังไม่รู้พรุ่งนี้ต้องเจอกับเรื่องใด
 (* ,** )
S0LO     G/Am/Bm/C 2 time

          Em        Bm
แต่ยิ่งชีวิต ยิ่งผ่าน ยิ่งได้พบ ยิ่งเจอ
               Am            D
 กลับทำให้ฉันยิ่งคิด     แน่ใจ
 (**)

951
all application on unix knowledges by golfreeze / install vhcs2.4.8 on debian
« on: มิถุนายน 27, 2011, 05:02:38 PM »
How to Install Hosting Control Panel - VHCS2
============================================

1. install Debian Lenny (Debian 5.0)

   1.1) sudo nano /etc/network/interfaces

   auto eth0
   iface eth0 inet static
   address 192.168.1.x
   netmask 255.255.255.0
   gateway 192.168.1.1
        network 192.168.1.0
        broadcast 192.168.1.255

   sudo /etc/init.d/networking restart

  
   1.2) install ssh
  
        apt-get install ssh openssh-server


   1.3) via ssh

        a) ssh setting
           ===========
  
      protocol ssh2
      hostname 192.168.1.101
      port 22
      username XXX
      authentication password
      password XXXXXXserver01
      

    1.4) nano /etc/hosts

         127.0.0.1       localhost.localdomain localhost
      192.168.1.101   server01.99webhosting.com     server01


        /etc/init.d/hostname.sh start  
  
        test:   hostname
            hostname –f


     1.5) nano /etc/resolv.conf

   domain 99webhosting.com
   search 99webhosting.com
   nameserver 192.168.1.101
   nameserver 192.168.1.102
   nameserver 207.69.188.185
   nameserver 207.69.188.186
   nameserver 207.69.188.187


     1.6) change the default Shell:
  
          rm -f /bin/sh
          ln -s /bin/bash /bin/sh


     1.7) update and install

         aptitude update
         aptitude upgrade
         aptitude install tar bzip2 wget lsb-release


2. install some packages

   2.1) cd tmp

   2.2) nano debian5-packages.txt

   apache2
   apache2.2-common
   apache2-mpm-prefork
   bind9
   bzip2
   courier-authdaemon
   courier-base
   courier-imap
   courier-maildrop
   courier-pop
   diff
   dnsutils
   gcc
   gzip
   iptables
   libapache2-mod-php5
   libberkeleydb-perl
   libc6-dev
   libcrypt-blowfish-perl
   libcrypt-cbc-perl
   libcrypt-passwdmd5-perl
   libdate-calc-perl
   libdate-manip-perl
   libdbd-mysql-perl
   libdbi-perl
   libio-stringy-perl
   libmail-sendmail-perl
   libmailtools-perl
   libmcrypt4
   libmd5-perl
   libmime-perl
   libnet-dns-perl
   libnet-netmask-perl
   libnet-perl
   libnet-smtp-server-perl
   libperl5.10
   libsasl2-2
   libsasl2-modules
   libsnmp-session-perl
   libterm-readkey-perl
   libterm-readpassword-perl
   libtimedate-perl
   make
   mysql-client
   mysql-common
   mysql-server
   original-awk
   patch
   perl
   perl-base
   perl-modules
   php5
   php5-gd
   php5-mcrypt
   php5-mysql
   php-pear
   postfix
   postfix-tls
   procmail
   proftpd
   sasl2-bin
   ssh
   tar
   wget






   2.3) aptitude install $(cat ./debian5-packages.txt)


   2.3) answer questions, and edit /etc/default/saslauthd

   1) New Password for MYSQL "root" user:
        2) General type of mail configuration: --> Internet Site
        3) System mail name:
        4) ProFTPd configuration: standalone
      

3. Shutdown unwanted services from inetd

       update-inetd --remove daytime
       update-inetd --remove telnet
       update-inetd --remove time
       update-inetd --remove finger
       update-inetd --remove talk
       update-inetd --remove ntalk
       update-inetd --remove ftp
       update-inetd --remove discard  


4. some config and test

   4.1) sasl

        nano /etc/default/saslauthd

        START=yes


   4.2) postfix

        a) nano /etc/postfix/main.cf

           myhostname = mail.99webhosting.com
           mydestination = 99webhosting.com, server01.99webhosting.com, localhost.99webhosting.com, localhost

        b) nano /etc/mailname
    
           99webhosting.com
 
        c) test:  1) telnet localhost 25  

                     ehlo localhost
                                      
                  2) send mail:   date | mail -s “testing” rXXX7777777@gmail.com   //note: apt-get install mailutils
                            
                  3) monitoring:  tail -f /var/log/mail.log


    4.3) Courier-IMAP / POP3


         test: telnet localhost imap / pop3  
  


    4.4) Anti-Spam / virus


   4.4.1) installation

      sudo apt-get install amavisd-new spamassassin clamav-daemon
      sudo apt-get install dkim-filter python-policyd-spf
      sudo apt-get install pyzor razor
      sudo apt-get install arj cabextract cpio nomarch pax unzip zip zoo

        or:

        apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax
    




   4.4.2) configuration

            a) ClamAV

                 add clamav user to the amavis group in order for
                 Amavisd-new to have the appropriate access to scan files
                 (sudo nano /etc/clamav)  

                 sudo adduser clamav amavis

    
            b) Spamassassin
 
                 sudo nano /etc/default/spamassassin

                 ENABLED=1   #activate the Spamassassin daemon

      
                 then start it: sudo /etc/init.d/spamassassin start


           c) Amavisd-new
            
                 1) activate spam and antivirus detection in Amavisd-new

         sudo nano /etc/amavis/conf.d/15-content_filter_mode
 

                @bypass_virus_checks_maps = (
                       \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);


                @bypass_spam_checks_maps = (
                      \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);

      
       2*) Bouncing spam is the default, you may discard it as bellow

                sudo nano /etc/amavis/conf.d/20-debian_defaults    

                $final_spam_destiny       = D_DISCARD;

          
             3) nano /etc/amavis/conf.d/05-node_id

                       $myhostname = "mail.99webhosting.com";

                 4)  nano /etc/amavis/conf.d/50-user  

                     $pax='pax';


          
             5)       /etc/init.d/amavis restart
                          /etc/init.d/clamav-daemon restart
                          /etc/init.d/clamav-freshclam restart

          

             d) DKIM Whitelist

          (once a domain has been added to the Whitelist, the message will not
               receive any anti-virus or spam filtering.)


                 nano /etc/amavis/conf.d/40-policy_banks
      
                       
                (Now restart Postfix: sudo /etc/init.d/postfix restart)


   4.4.3) test

         a) Amavisd-new SMTP is listening    (directly in Ubuntu system)
      
               telnet localhost 10024
               Trying 127.0.0.1...
               Connected to localhost.
               Escape character is '^]'.
               220 [127.0.0.1] ESMTP amavisd-new service ready
               ^]
      


    4.5) apache2

         http://192.168.1.101



    4.6) sql

         4.6.1) create database and user
                        
              # mysql -u root -p
 
           create database 99webhosting;
           use 99webhosting

           grant all privileges on *.* to 'XXX'@'localhost' identified by 'XXXXXXmysql' with grant option;
           \q

         4.6.2) install

            apt-get install mysql-server mysql-client libmysqlclient15-dev
                apt-get install phpmyadmin
    
       
         4.6.3) test: http://192.168.1.101/phpmyadmin/


     4.7) BIND9

          test:

          1) /etc/init.d/bind9 restart
          2) to add the ip of the DNS server (the localhost) to your /etc/resolv.conf to use it:

               nano /etc/resolv.conf

                 nameserver 127.0.0.1

          3) ping www.google.com
 

      4.8) FTP


           test:  /etc/init.d/proftpd restart

                  telnet localhost ftp



5. mount the external disk

   5.1)  to make hard disk ready


         1) check partition

            fdisk -l
 
         2) make partition type (Linux), for ext2 and ext3:

            fdisk /dev/sdb


         3) make file system (format)
          
            mke2fs /dev/sdb1

            
            (Ext3 requires one more step:)

            tune2fs -j /dev/sdb1               (creates the ext3 journal)


         4)  change the frequency of forced file system checking (wouldn't do this routine checking)

             tune2fs -c 0 /dev/sdb1
             tune2fs -i 0 /dev/sdb1


    5.2) mkdir /media/disk500GB

         chmod -R 777 /media/disk500GB
    

    5.3) mount -t ext3 /dev/sdb1 /media/disk500GB

         or:

         1) nano /etc/fstab

            /dev/sdb1    /media/disk500GB   ext3    defaults        0       0


         2) reboot or mount -a
        

    
     5.4) check: mount


     5.5) fix

          1) nano /usr/share/initramfs-tools/init
  
             maybe_break mount
           sleep 10
             log_begin_msg "Mounting root file system..."


          2) /usr/sbin/update-initramfs -uk all





952
more .htaccess tips and tricks..
<ifModule>
more clever stuff here
</ifModule>
 
redirecting and rewriting

    "The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail."

    - Brian Behlendorf, Apache Group

 

One of the more powerful tricks of the .htaccess hacker is the ability to rewrite URLs. This enables us to do some mighty manipulations on our links; useful stuff like transforming very long URL's into short, cute URLs, transforming dynamic ?generated=page&URL's into /friendly/flat/links, redirect missing pages, preventing hot-linking, performing automatic language translation, and much, much more.

Make no mistake, mod_rewrite is complex. This isn't the subject for a quick bite-size tech-snack, probably not even a week-end crash-course, I've seen guys pull off some real cute stuff with mod_rewrite, but with kudos-hat tipped firmly towards that bastard operator from hell, Ralf S. Engelschall, author of the magic module itself, I have to admit that a great deal of it still seems so much voodoo to me.

The way that rules can work one minute and then seem not to the next, how browser and other in-between network caches interact with rules and testing rules is often baffling, maddening. When I feel the need to bend my mind completely out of shape, I mess around with mod_rewrite!

After all this, it does work, and while I'm not planning on taking that week-end crash-course any time soon, I have picked up a few wee tricks myself, messing around with web servers and web sites, this place..

The plan here is to just drop some neat stuff, examples, things that have proven useful, and work on a variety of server setups; there are Apache's all over my LAN, I keep coming across old .htaccess files stuffed with past rewriting experiments that either worked; and I add them to my list, or failed dismally; and I'm surprised that more often these days, I can see exactly why!

Very little here is my own invention. Even the bits I figured out myself were already well documented, I just hadn't understood the documents, or couldn't find them. Sometimes, just looking at the same thing from a different angle can make all the difference, so perhaps this humble stab at URL Rewriting might be of some use. I'm writing it for me, of course. but I do get some credit for this..

    # time to get dynamic, see..
    RewriteRule (.*)\.htm $1.php

 

beginning rewriting..
Whenever you use mod_rewrite (the part of Apache that does all this magic), you need to do..

    you only need to do this once per .htaccess file:
    Options +FollowSymlinks
    RewriteEngine on


..before any ReWrite rules. note: +FollowSymLinks must be enabled for any rules to work, this is a security requirement of the rewrite engine. Normally it's enabled in the root and you shouldn't have to add it, but it doesn't hurt to do so, and I'll insert it into all the examples on this page, just in case*.

The next line simply switches on the rewrite engine for that folder. if this directive is in you main .htaccess file, then the ReWrite engine is theoretically enabled for your entire site, but it's wise to always add that line before you write any redirections, anywhere.

* Although highly unlikely, your host may have +FollowSymLinks enabled at the root level, yet disallow its addition in .htaccess; in which case, adding +FollowSymLinks will break your setup (probably a 500 error), so just remove it, and your rules should work fine.

Important: While some of the directives on this page may appear split onto two lines in your browser, in your .htaccess file they must exist completely on one line. If you drag-select and copy the directives on this page, they should paste just fine into any text editor.
 

simple rewriting
Simply put, Apache scans all incoming URL requests, checks for matches in our .htaccess file and rewrites those matching URLs to whatever we specify. something like this..

    all requests to whatever.htm will be sent to whatever.php:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^(.*)\.htm$ $1.php [NC]


Handy for anyone updating a site from static htm (you could use .html, or .htm(.*), .htm?, etc) to dynamic php pages; requests to the old pages are automatically rewritten to our new urls. no one notices a thing, visitors and search engines can access your content either way. leave the rule in; as an added bonus, this enables us to easily split php code and its included html structures into two separate files, a nice idea; makes editing and updating a breeze. The [NC] part at the end means "No Case", or "case-insensitive"; more on the switches, later.

Folks can link to whatever.htm or whatever.php, but they always get whatever.php in their browser, and this works even if whatever.htm doesn't exist! But I'm straying..

As it stands, it's a bit tricky; folks will still have whatever.htm in their browser address bar, and will still keep bookmarking your old .htm URL's. Search engines, too, will keep on indexing your links as .htm, some have even argued that serving up the same content from two different places could have you penalized by the search engines. This may or not bother you, but if it does, mod_rewrite can do some more magic..

    this will do a "real" external redirection:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^(.+)\.htm$ http://corz.org/$1.php [R,NC]


This time we instruct mod_rewrite to do a proper external rewrite, aka, "redirection". Now, instead of just background rewriting on-the-fly, the user's browser is physically redirected to a new URI, and whatever.php appears in their browser's address bar - search engines and other spidering entities will automatically update their links to the .php versions; everyone wins. You can take your time with the updating, too.

Note: if you use [R] alone, it defaults to sending an HTTP "MOVED TEMPORARILY" redirection, aka, "302". But you can send other codes, like so..

    this performs the exact same as the previous example RewriteRule.
    RewriteRule ^(.+)\.htm$ http://corz.org/$1.php [R=302,NC]


Okay, I sent the exact same code, but I didn't have to. For details of the many 30* response codes you can send, see here. Most people seem to want to send 301, aka, "MOVED PERMENENTLY".

Note: if you add an "L" flag to the mix; meaning "Last Rule", e.g. [R=302,NC,L]; Apache will stop processing rules for this request at that point, which may or may not be what you want. Either way, it's useful to know.
 

not-so-simple rewriting ... flat links and more
You may have noticed, the above examples use regular expression to match variables. What that simply means is.. match the part inside (.+) and use it to construct "$1" in the new URL. In other words, (.+) = $1 you could have multiple (.+) parts and for each, mod_rewrite automatically creates a matching $1, $2, $3, etc, in your target (aka. 'substitution') URL. This facility enables us to do all sorts of tricks, and the most common of those, is the creation of "flat links"..

Even a cute short link like http://mysite/grab?file=my.zip is too ugly for some people, and nothing less than a true old-school solid domain/path/flat/link will do. Fortunately, mod_rewrite makes it easy to convert URLs with query strings and multiple variables into exactly this, something like..

    a more complex rewrite rule:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^files/([^/]+)/([^/]+).zip /download.php?section=$1&file=$2 [NC]


would allow you to present this link as..

  http://mysite/files/games/hoopy.zip

and in the background have that transparently translated, server-side, to..

  http://mysite/download.php?section=games&file=hoopy

which some script could process. You see, many search engines simply don't follow our ?generated=links, so if you create generating pages, this is useful. However, it's only the dumb search engines that can't handle these kinds of links; we have to ask ourselves.. do we really want to be listed by the dumb search engines? Google will handle a good few parameters in your URL without any problems, and the (hungry hungry) msn-bot stops at nothing to get that page, sometimes again and again and again…

I personally feel it's the search engines that should strive to keep up with modern web technologies, in other words; we shouldn't have to dumb-down for them. But that's just my opinion. Many users will prefer /files/games/hoopy.zip to /download.php?section=games&file=hoopy but I don't mind either way. As someone pointed out to me recently, presenting links as standard/flat/paths means you're less likely to get folks doing typos in typed URL's, so something like..

    an even more complex rewrite rule:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^blog/([0-9]+)-([a-z]+) http://corz.org/blog/index.php?archive=$1-$2 [NC]


would be a neat trick, enabling anyone to access my blog archives by doing..

 http://corz.org/blog/2003-nov

in their browser, and have it automagically transformed server-side into..

 http://corz.org/blog/index.php?archive=2003-nov

which corzblog would understand. It's easy to see that with a little imagination, and a basic understanding of posix regular expression, you can perform some highly cool URL manipulations.

Here's the very basics of regexp (expanded from the Apache mod_rewrite documentation)..
 

    Escaping:

    \char escape that particular char

        For instance to specify special characters.. [].()\ etc.

    Text:

    .             Any single character  (on its own = the entire URI)
    [chars]       Character class: One of following chars
    [^chars]      Character class: None of following chars
    text1|text2   Alternative: text1 or text2 (i.e. "or")

        e.g. [^/] matches any character except /
             (foo|bar)\.html matches foo.html and bar.html

    Quantifiers:

    ? 0 or 1 of the preceding text
    * 0 or N of the preceding text  (hungry)
    + 1 or N of the preceding text

        e.g. (.+)\.html? matches foo.htm and foo.html
             (foo)?bar\.html matches bar.html and foobar.html

    Grouping:

    (text)  Grouping of text

        Either to set the borders of an alternative or
        for making backreferences where the nthe group can
        be used on the target of a RewriteRule with $n

       e.g.  ^(.*)\.html foo.php?bar=$1

    Anchors:

    ^    Start of line anchor
    $    End   of line anchor

        An anchor explicitly states that the character right next to it MUST
        be either the very first character ("^"), or the very last character ("$")
        of the URI string to match against the pattern, e.g..
       
       ^foo(.*) matches foo and foobar but not eggfoo
       (.*)l$ matches fool and cool, but not foo

 

shortening URLs
One common use of mod_rewrite is to shorten URL's. Shorter URL's are easier to remember and, of course, easier to type. An example..

    beware the regular expression:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^grab /public/files/download/download.php


this rule would transform this user's URL..

  http://mysite/grab?file=my.zip

server-side, into..

  http://mysite/public/files/download/download.php?file=my.zip

which is a wee trick I use for my distro machine, among other things. everyone likes short URL's, and so will you; using this technique, you can move /public/files/download/ to anywhere else in your site, and all the old links still work fine; simply alter your .htaccess file to reflect the new location. edit one line, done - nice - means even when stuff is way deep in your site you can have cool links like this.. /trueview/sample.php and this; links which are not only short, but flat..
 

capturing variables
Slapping (.*) onto the end of the request part of a ReWriteRule is just fine when using a simple $_GET variable, but sometimes you want to do trickier things, like capturing particular variables and converting them into other variables in the target URL. Or something else..

When capturing variables, the first thing you need to know about, is the [QSA] flag, which simply tags all the original variables back onto the end of the target url. This may be all you need, and will happen automatically for simple rewrites. The second thing, is %{QUERY_STRING}, an Apache server string we can capture variables from, using simple RewriteCond (aka. conditional ) statements.

RewriteCond is very like doing if...then...do in many programming languages. If a certain condition is true, then do the rewrite that follows..

In the following example, the RewriteCond statement checks that the query string has the foo variable set, and captures its value while it's there. In other words, only requests for /grab that have the variable foo set, will be rewritten, and while we're at it, we'll also switch foo, for bar, just because we can..

    capturing a $_GET variable:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} foo=(.*)
    RewriteRule ^grab(.*) /page.php?bar=%1


would translate a link/user's request for..

http://domain.com/grab?foo=bar

server-side, into..

http://domain.com/page.php?bar=bar

Which is to say, the user's browser would be fed page.php (without an [R] flag in the RewriteRule, their address bar would still read /grab?foo=bar). The variable bar would be available to your script, with its value set to bar. This variable has been magically created, by simply using a regular ? in the target of the RewriteRule, and tagging on the first captured backreference, %1.. ?bar=%1

Note how we use the % character, to specify variables captured in RewriteCond statements, aka "Backreferences". This is exactly like using $1 to specify numbered backreferences captured in RewriteRule patterns, except for strings captured inside a RewriteCond statement, we use % instead of $. Simple.

You can use the [QSA] flag in addition to these query string manipulations, merge them. In the next example, the value of foo becomes the directory in the target URL, and the variable file is magically created. The original query string is then tagged back onto the end of the whole thing..

    QSA Overkill!
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} foo=(.+)
    RewriteRule ^grab/(.*) /%1/index.php?file=$1 [QSA]


So a request for..

http://domain.com/grab/foobar.zip?level=5&foo=bar

is translated, server-side, into..

http://domain.com/bar/index.php?file=foobar.zip&level=5&foo=bar

Depending on your needs, you could even use flat links and dynamic variables together, something like this could be useful..

    mixing flat and dynamic links in a single ruleset..
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} version=(.+)
    RewriteRule ^grab/([^/]+)/(.*) /%1/index.php?section=$1&file=$2 [QSA]


By the way, you can easily do the opposite, strip a query string from a URL, by simply putting a ? right at the end of the target part. This example does exactly that, whilst leaving the actual URI intact..

    just a demo!
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} .
    RewriteRule foo.php(.*) /foo.php? [L]

The RewriteCond statement only allows requests that have something in their query string, to be processed by the RewriteRule, or else we'd end up in that hellish place, dread to all mod_rewriters.. the endless loop. RewriteCond is often used like this; as a safety-net.

953
วันนี้ ว่าจะมาอัฟข้อมูลเกี่ยวกับ เรื่องของ heartbeat version 3 + drbd + pacemaker ครับ
ซึ่งใช้งานบน production จริงๆ ครับ แล้วก็มีประสิทธิภาพในการใช้งานดี ทีเดียว

เลยอยากนำมาแบ่งปัน เพื่อนๆ ดูครับ เผื่อจะได้นำไปประยุกต์ใช้ เพื่อให้เกิดประโยชน์แก่ สังคม ต่อไป

###โจทย์
1. ให้ทำระบบ web ที่ใช้งานกับ ldap ให้มีประสิทธิภาพในการใช้งาน คือถ้า node หลักตาย ให้ย้ายการทำงานไป node รองได้ โดยที่ส่วนของ database ต้องใช้งานได้ปกติ

###ทรัพยากร
1. มีเครื่องserver ldap 2 ตัว ทำ virtual ip กัน

###Main Application:
Heartbeat V.3 : ทำหน้าที่ fail over service เช่น node master ตายจะ เช๊ค process แล้วย้ายไปทำงาน slave node แทน
drbd83 : ทำหน้าที่ disk replicate block data คือทำหน้าที่เก็บ data ไว้ใน path ที่เป็น drbd เวลาที่ heartbeat ย้ายไปทำงานที่ slave node ก็จะทำการย้าย path นี้ไปด้วย
Pacemaker :  ทำหน้าที่ เพิ่มประสิทธิภาพในการทำ fail over service ให้กับ heartbeat ครับ
apache2 :  ทำหน้าที่ให้บริการเว็บเพจ
openldap : เก็บ database ของลูกค้าเป็นรูปแบบ ldap

#####เริ่มกันเลย

1. ทำการ install OS = ผมใช้เป็น centos 5.4 AMD 64bit (ลงไว้ในรูปแบบนี้ ทั้งสองเครื่อง )
2. ตอนแบ่ง partition ต้องกันพื้นที่ disk ไว้ประมาณ 5G เพื่อใช้เป็น drbd path เก็บข้อมูล database

[root@ha0 etc]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 83 Linux
/dev/sda2 1306 1958 5245222+ 83 Linux      ==> อันนี้เป็น drbd path ครับ ไม่ต้อง mount ไว้ใน fstab นะครับ heartbeat จะทำให้เองหลังจากinstallเสร็จ
/dev/sda3 1959 1991 265072+ 82 Linux swap / Solaris   ==> Swap path

### ส่วนของ network ครับ
eth0 10.0.1.143 10.0.1.144 (Connected to switch)  ###สำหรับ service และ physical ip
eth1 192.168.56.101 192.168.56.102 (Directly connected with cross cable) ###สำหรับ heartbeat #0
eth2 10.1.0.1 10.1.0.2 (Directly connected with cross cable) ###สำหรับ heartbeat #1 และ ใช้ในการ sync data drbd ครับ

## เริ่มทำการ ลง application drbd ครับ (ตัวนี้ต้องลง ทั้ง kernel module ของ drbd ด้วยนะครับ) ลงเสร็จทำการปิด service ตอน startup ด้วยครับ ป้องกันไม่ให้ heartbeat สับสน

[root@ha0 ~]# yum install drbd83.x86_64 kmod-drbd83.x86_64
[root@ha0 ~]# chkconfig drbd off

หลังจากลง drbd เสร็จทำการ ปรับ full zero partition ที่ใช้ทำ drbd เพื่อให้พร้อมกับการใช้งานครับ

[root@ha0 etc]# dd if=/dev/zero of=/dev/sda2
dd: writing to `/dev/sda2': No space left on device
10490446+0 records in
10490445+0 records out
5371107840 bytes (5.4 GB) copied, 163.096 seconds, 32.9 MB/s
[root@ha0 etc]#

ทำการแก้ไข config "drbd.conf" ดังนี้ครับ
โดยที่  1 DRBD resource (r0) – DRBD target block device (/dev/sda2) - DRBD device name(/dev/drbd0).

#vi /etc/drbd.conf

global {
usage-count no;
}
common {
syncer { rate 30M;}
}
resource r0 {
protocol C;
disk {
on-io-error pass_on;
}
device /dev/drbd0;
disk /dev/sda2;
on ha0.test.aaa {
address 10.1.0.1:7788;
meta-disk internal;
}
on ha1.test.aaa {
address 10.1.0.2:7788;
meta-disk internal;
}
}

หลังจากทำ config เสร็จใน ldap server ทั้ง สองเครื่อง
ต่อไปทำการ สร้าง meta data ให้กับ drbd ครับ (รัน command นี้ทั้งสองเครื่อง)
[root@ha0 etc]# drbdadm create-md r0

เมื่อรันเสร็จแล้ว ถ้าเจอข้อความนี้แสดงว่าเสร็จ
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.

ต่อไปทำการ สั่ง start drbd service ให้ทำงาน โดย manual command (รัน command นี้ทั้งสองเครื่อง)
[root@ha0 etc]# /etc/init.d/drbd start

ถ้ารันได้สำเร็จจะขึ้น ข้อความแบบข้างล่าง ( ทั้งสองเครื่อง)
Starting DRBD resources: [
r0
Found valid meta data in the expected location, 5371101184 bytes into
/dev/sda2.
d(r0) s(r0) n(r0) ].
[root@ha0 etc]#

เสร็จแล้วทำการ check process drbd ว่าทำงานหรือเปล่า
[root@ha0 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by
mockbuild@builder10.centos.org, 2010-06-04 08:04:09
0: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----   ==> แสดงว่ายังไม่เริ่ม sync ข้อมูลกันครับ
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:5245020

### สำคัญ รัน command นี้ที่ master node นะครับ (เครื่องเดียวเท่านั้น)
[root@ha0 ~]# drbdadm -- --overwrite-data-of-peer primary r0

###เมื่อเสร็จแล้วทำการ check process drbd อีกครั้งครับ จะเห็นว่า เริ่ม sync data กันแล้วระหว่างสอง node 
[root@ha0 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by
mockbuild@builder10.centos.org, 2010-06-04 08:04:09
0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----   ==> ทำงานเป็น primary/secondary แล้ว
ns:544768 nr:0 dw:0 dr:544768 al:0 bm:33 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:4700252
[=>..................] sync'ed: 10.5% (4588/5120)M delay_probe: 104     ==> เริ่ม sync data กันแล้วครับ
finish: 0:07:09 speed: 10,868 Sync pro g(1re0s,s2 76) K/sec



954
วันก่อนมีโอกาสได้ดูเครื่องให้ลูกค้า ครับ
 
พอดีเขาให้หาสาเหตุ ของการติด blacklist กับ การส่งเมลจำนวนมากออกจาก server ครับ

สำหรับ qmail ตัวนี้ ผมไม่ค่อยได้จับซะเท่าไร ก็ได้แต่งมๆ ไปก่อนครับ

เริ่มจาก ดู queue ของจำนวนเมล ก็

###Check mailqueue
/var/qmail/bin/qmail-qstat

###Delete queue all mail
qmail-remove -r

###Delete queue specific domain
qmail-remove -r -p yahoo.com.tw

##restart qmail service
qmailctl restart

###Check header mail
less /var/qmail/queue/mess/9/7876612

แต่ถ้าจะดูพวก log mail ของขอส่งก็
[root@mail smtp]#cd /var/log/qmail/smtp

[root@mail smtp]# pwd
/var/log/qmail/smtp

[root@mail smtp]# tail -f current

955
Music for relax / ของขวัญ - Musketeers
« on: พฤษภาคม 05, 2011, 11:09:36 PM »
ของขวัญ - Musketeers

แก้ไขเนื้อร้อง ชาครีย์ ลาภบุญเรือง
ทำนอง ชาครีย์ ลาภบุญเรือง
เรียบเรียง Musketeers และ สมคิด กุลโรจน์ปัญญา

        A            F#m7
มีเรื่องราวมากมาย ที่ไม่มีใครได้ฟัง คำพูดนับร้อยพัน
          Bm7
ที่ต้องการเอื้อนเอ่ย ไม่ว่าจะนานซักเท่าไหร่
   E
ยังยืนยันคำเดิมเสมอ ไม่เคยเปลี่ยน
            Dmaj7   E   
Pre(*) เธอทำให้ฉันรู้และเข้าใจคำว่าสองเรา
             C#m7-5              F#7sus4/F#7
ไม่ว่าจะร้อนหรือว่าจะหนาวก็ไม่กลัว
           Bm7   C#m7      Dmaj7  E
มีเธอที่รักข้างในจิตใจ ให้ฉันก้าวเดินต่อไป ต่อจากนี้
                A   F#m7      Bm7
Chorus(**) เธอและฉัน.... จับมือเคียงกันนับจากนี้
E      C#m7   F#m7
ผ่านความเดียวดายที่สองเรานั้นเคยมี
          Bm7      E   
เมื่อมีเธอคนที่แสนดีอยู่ตรงนี้
             A            F#m7     Bm7   
มากกว่านั้น.... ยิ่งมีกันและกันมากแค่ไหน
    E            C#m7        F#m7
มีเพียงคำว่ารักที่สองเรานั้นเข้าใจ
            Bm7           E      A(Fmaj7/E)   
รักเพียงเธอและตลอดไป (แค่เธอกับฉัน)
Instru: A/Dmaj7
   A
และนับจากนี้ไป ทุกเรื่องราวที่ได้ฟัง
         F#m7
คำพูดทุกถ้อยคำที่คอยย้ำเตือนใจ
              Bm7      E   
ไม่ว่าจะไกลซักเท่าไหร่ เพียงมีเธอคนดีอย่างนี้
ไม่ไหวหวั่น
(*)(**)(soloA(2times) Fmaj7/E/E/E)(*)(**)
A      Fmaj7 E     Amaj7
(จะมีเพียงสองเรา ต่อจากนี้)     (แค่เธอกับฉัน)

956
Mail issue , problem , configuration / set google app mail on directadmin
« on: พฤษภาคม 03, 2011, 04:10:57 PM »
set google app mail on directadmin

###GOOGLE site###
Google apps มีบริการที่น่าสนใจคือ Googlr mail ที่ให้พื้นที่เก็บอีเมลล์ขนาด 6GB และสามารถเอาโดเมนของเราสมัคร Google apps ได้ และอีเมลล์ที่ได้ก็จะเป็น yourname@yourdomain.com เช่น jirawat@picohosting.com สำหรับคนที่สนใจจะสมัคร Google apps สามารถสมัครได้ที่
http://www.google.com/a/cpanel/domain/new โดยขั้นตอนการสมัครมีดังนี้

1. ใส่ชื่อ domain
2. set configure เกี่ยวกับค่า domain และ create user + group mail
3. เสร็จแล้วทำการ verify domain ด้วยไฟล์ googlehostedservice.html
4. ไปทำในส่วนของ mx ที่ zone file ของ domain เราครับ

###(End) GOOGLE site###

### Your domain site on directadmin ###
   1. Login to DirectAdmin.
   2. Make sure you are on the User Level.
   3. Select the domain you want to edit the MX record for (If you only have one domain on your account, you don't need to do this step).
   4. Click on MX Records under the E-Mail Management section.
   5. Select any MX Records that are there, and then click delete.
   6. Put ASPMX.L.GOOGLE.COM. in the text box, and select 10 in the drop-down box. Click Add.
   7. Put ALT1.ASPMX.L.GOOGLE.COM. in the text box, and select 20 in the drop-down box. Click Add.
   8. Put ALT2.ASPMX.L.GOOGLE.COM. in the text box, and select 30 in the drop-down box. Click Add.
   9. Put ASPMX2.GOOGLEMAIL.COM. in the text box, and select 40 in the drop-down box. Click Add.
  10. Put ASPMX3.GOOGLEMAIL.COM. in the text box, and select 50 in the drop-down box. Click Add.
  11. Uncheck the box beside Use this server to handle my emails.
      If not, change the MX record and uncheck this option.
      Then, click Save.

### (End) Your domain site on directadmin ###

958
เครื่อง POP ผมที่ลงเป็น Linux Debian ครับมีปัญหาในการ restart service ครับ ทำให้ไม่สามารถ connect smtp 25 ได้ครับ

ซึ่งลองหาอ่านดูเป็นเพราะ script postfix ใน init script มี bug ครับ

POP01:/etc/postfix# /etc/init.d/postfix restart
Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfixpostfix/postfix-script: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
 failed!


ลองดู error ใน mail.err ได้ดังนี้ ครับ
POP01:/etc/postfix# tail -f /var/log/mail.err
Apr 23 22:12:45 POP01 postfix/postfix-script[8723]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:03:04 POP01 postfix/postfix-script[14351]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:07:34 POP01 postfix/postfix-script[14617]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:25:13 POP01 postfix/postfix-script[16467]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:34:40 POP01 postfix/postfix-script[16985]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:35:03 POP01 postfix/postfix-script[17064]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:36:06 POP01 postfix/postfix-script[17171]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:38:07 POP01 postfix/postfix-script[17323]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:51:26 POP01 postfix/postfix-script[18150]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Apr 24 00:57:41 POP01 postfix/postfix-script[18496]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)

แก้ไขโดยเข้าไปดูที่ ไฟล์
#cp /etc/init.d/postfix /home/xxx/init_postfix_2011
#vi /etc/init.d/postfix

แก้ไขบันทัด
if start-stop-daemon --start --exec ${DAEMON} -- quiet-quick-start; then
เป็น
if start-stop-daemon --start --exec ${DAEMON} start -- quiet-quick-start; then

แล้วทำการ restart postfix ใหม่ครับผม

#/etc/init.d/postfix restart

ได้แล้ว อิอิ

POP01:/etc/init.d# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 POP01.Packetlove ESMTP Postfix

959
วันนี้ได้ลองเทสการทำงานของ ipv6 บน freebsd ดูครับ เลยลองมาเขียนไว้ ฮ่าๆๆๆ

เริ่มต้นด้วย ได้รับ ipv6 มาครับของผมเป็น (/64) = 2403:xxxx:x:x::250

ส่วน gateway ก็เป็น 2403:xxxx:x:x::1

intername = em0

ทำการ set ที่ไฟล์ /etc/rc.conf

#vi /etc/rc.conf

###IPV6 Testing
ipv6_enable="YES"
ipv6_ifconfig_em0="2403:xxxx:x:x::250"
ipv6_defaultrouter="2403:xxxx:x:x::1"
###IPV6 Test

### restart network
#/etc/rc.d/network_ipv6 restart

ถ้าจะทำการเพิ่ม add interface ip ที่ทำ ipv6 ก็
#ifconfig em0 inet6 add 2403:xxxx:x:x::251
ครับ

ถ้าจะทำการลบ delete interface ip ที่ทำ ipv6 ก็
#ifconfig em0 inet6 2403:xxxx:x:x::251 delete
ครับ

Add specific route to host (เพิ่ม)
#route add -inet6 2403:xxxx:x:x::1

Add specific route to network (เพิ่ม)
#route add -inet6 2001:800:40::1 2403:xxxx:x:x::1

Remove specific route (ลบ)
#route delete -inet6 2001:800:40::/48 fe80::209:c0ff:fe30:4357

Add default IPv6 route (เพิ่ม default route)
#route add -inet6 ::/0 2403:xxxx:x:x::1

Remove default IPv6 route (ลบ default route)
#route delete -inet6 ::/0 2403:xxxx:x:x::1

ในส่วนนี้ kernel ต้องถูก enable แล้วนะครับ ไปดูได้จาก

#uname -a

ถ้าเป็น i386 ก็เข้าไปดูได้ที่ #less /usr/src/sys/i386/conf/NS0_FREEBSD62_INET6

options         INET6                   # IPv6 communications protocols

ถ้าเป็นอย่างนี้ แสดงว่าถูก enable ไว้แล้วครับ แต่ถ้ายังก็ ทำการ compile kernel ให้ support INET6 ครับ

#config NS0_FREEBSD62_INET6
#cd /usr/src

#make kernel KERNCONF=NS0_FREEBSD62_INET6
#make installkernel KERNCONF=NS0_FREEBSD62_INET6

เสร็จแล้วทำการ restart เครื่อง 1 รอบครับ เท่านี้ ก็ลองเทสได้เลยครับผม

ns0# dig @2403:xxxx:x:x::100 www.kame.net any

; <<>> DiG 9.3.3 <<>> @2403:xxxx:x:x::100 www.kame.net any
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45430
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 5

;; QUESTION SECTION:
;www.kame.net.                  IN      ANY

;; ANSWER SECTION:
www.kame.net.           85196   IN      CNAME   orange.kame.net.

;; AUTHORITY SECTION:
kame.net.               85196   IN      NS      orange.kame.net.
kame.net.               85196   IN      NS      mango.itojun.org.

;; ADDITIONAL SECTION:
mango.itojun.org.       2397    IN      A       210.155.141.200
mango.itojun.org.       2398    IN      AAAA    2001:2f0:0:8800::1:1
mango.itojun.org.       2398    IN      AAAA    2001:2f0:0:8800:206:5bff:fe8d:940
orange.kame.net.        85235   IN      A       203.178.141.194
orange.kame.net.        85196   IN      AAAA    2001:200:dff:fff1:216:3eff:feb1:44d7

;; Query time: 0 msec
;; SERVER: 2403:xxxx:x:x::100#53(2403:xxxx:x:x::100)
;; WHEN: Sun Apr 24 08:13:38 2011
;; MSG SIZE  rcvd: 211

แค่นี้ก็แสดงว่า เครื่อง DNS เรา support IPV6 แล้วครับผม อิอิ

960
พอดีลองดู list เว็บที่ใช้เช๊คพวก blacklist ip ครับ เผื่อเพื่อนๆ ท่านไหนหาอยู่จะได้ใช้ประโยชน์ด้วย

http://www.dnsbl.info

###More reference
http://multirbl.valli.org
 
http://www.spamhaus.org/query/bl?ip=x.x.x.x
x.x.x.x คือ ip address ของเราที่ต้องการเช๊ค blacklist ครับ IPV4 ครับผม แก้ไขเป็น ip ของท่านด้วยนะครับ เช่น 127.127.127.127

http://www.barracudacentral.org/reputation?ip=x.x.x.x
x.x.x.x คือ ip address ของเราที่ต้องการเช๊ค blacklist ครับ IPV4 ครับผม แก้ไขเป็น ip ของท่านด้วยนะครับ เช่น 127.127.127.127

http://www.spamcop.net/bl.shtml

http://www.mxtoolbox.com/blacklists.aspx

http://www.au.sorbs.net/lookup.shtml

ส่วนใหญ่จะมีประมาณนี้ ครับท่านใดมีเพิ่มเติมก็โฟสบอกไว้ได้นะครับผม  ;)

Pages: 1 ... 62 63 [64] 65 66 ... 73