[Highlights] nginx [php, location, alias, 504]

Source: Internet
Author: User
[Summary] nginx [php, location, alias, 504 ]?? Install unzip tar-zxvfnginx-1.0.5.tar.gz # cdnginx-1.0.5 #./configure -- prefix =/usr/local/nginx # make [summary] nginx [php, location, alias, 504]

?? Install

#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

?

?

?? Configuration 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;        }    }}
?

?

?? The necessity of using rewrite in alias:

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

?

?

?? Nginx location rules

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

location [=|~|~*|^~|@] /uri/ { … }
'=' Indicates exact match. if it is found, stop searching and process the request immediately. 〖~ <G id = "1"> case-sensitive matching </g> 〖~ *] Indicates case-insensitive matching ~ . [@] Specifies a named location, which is generally only used for internal redirect requests.

?? Configure an instance

Location =/{# only matches the/directory query. [config A]} location/{# matches the query that starts with/, that is, all queries match. [Config B]} location ^ ~ /Images/{# matches queries starting with/images/and does not check regular expressions. [Config C]} location ~ * \. (Gif | jpg | jpeg) $ {# matches the files ending with gif, jpg, or jpeg, but the priority is lower than config C. [Config D]}
?

?

?? Solutions for nginx 504 Gateway Time-out

?? 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 local test is not significant and there is time to attach the configuration instructions

?

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.