"Collection" Nginx "php,location,alias,504"

Source: Internet
Author: User
"Summary" Nginx "php,location,alias,504"

?? Installation

#tar-zxvf nginx-1.0.5.tar.gz#cd nginx-1.0.5#./configure--prefix=/usr/local/nginx#make#make Install

?

?

?? Start

Start #/usr/local/nginx/sbin/nginx//restart #/usr/local/nginx/sbin/nginx-s reload#/usr/local/nginx/sbin/nginx-s reopen

?

?

?? Configuring 1-php (fastcgi installation)

?? Configure 2-alias

..... http {    ...    .. server {        ....        . # http://.../a/        location/a/{            alias/var/www/a/;        }        # http://.../a/*.php Location        ~/a/.+\.php$ {            rewrite    /a/(. +\.php)/$1 break;            Alias    /var/www/a/;            Fastcgi_pass    127.0.0.1:9000;            Fastcgi_index    index.php;            Fastcgi_param    script_filename  $document _root$fastcgi_script_name;            Include    fastcgi_params;        }        # http://.../Location        /{            alias/var/www/root/;        }        # http://.../*.php location        ~* \. ( PHP) $ {            alias    /var/www/root/;            Fastcgi_pass    127.0.0.1:9000;            Fastcgi_index    index.php;            Fastcgi_param    script_filename  $document _root$fastcgi_script_name;            Include    Fastcgi_params;}}}    
?

?

?? About the need to use rewrite in alias:

?? Citation URL: http://www.pppei.net/blog/post/133

?

?

?? About the location rules of Nginx

?? Citation URL: https://wangyan.org/blog/nginx-location.html

Location [=|~|~*|^~|@]/uri/{...}
〖=〗 represents an exact match, and if found, stops the search immediately and processes the request immediately. 〖~〗 indicates a case-sensitive match 〖~*〗 indicates a case-insensitive match 〖^~〗 means that only the string is matched and the regular expression is not queried. [Email protected] Specifies a named location, which is typically used only for internal redirection requests.

?? Configuration instance

Location  =/{  # matches only the query for the/directory.  [Config A]} Location  /{  # matches the/start query, that is, all queries match.  [config B]}location ^~/images/{  # matches a query starting with/images/and no longer checks for regular expressions.  [config C]}location ~* \. (gif|jpg|jpeg) $ {  # matches files ending with gif, JPG, or JPEG, but with a priority lower than config C.  [config D]}
?

?

?? Some methods of solving Nginx 504 Gateway time-out

?? Citation URL: http://blog.csdn.net/tengzhaorong/article/details/5814905

Fastcgi_buffers 2 256k;fastcgi_buffer_size 128k;fastcgi_busy_buffers_size 256k;fastcgi_temp_file_write_size 256K;

?? Note: The native test is not significant, there is time to attach the configuration instructions

?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.