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