"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
?