关于nginx配置的不完全总结
生活随笔
收集整理的這篇文章主要介紹了
关于nginx配置的不完全总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
請參考官方:
http://wiki.nginx.org/HttpRewriteModule#Synopsis
關于緩存大小權限
error log 有如下日志:an upstream response is buffered to a temporary file,
注意:當臨時文件提示沒有權限寫時,發發送給客戶端只接收到的這部分數據。
fastcgi_buffer_size 512k;fastcgi_buffers 6 512k;fastcgi_busy_buffers_size 512k;fastcgi_temp_file_write_size 512k;默認的vhost
listen 80 default_server;server_name _;增加Nginx請求緩存
location =/test_oss/cgi_interface/get_rs_proxy_by_domain.php {add_header X-Location cae_data_cache;add_header X-Cached $upstream_cache_status;fastcgi_cache fcgi_cache;fastcgi_cache_key "$request_method$uri$is_args$arg_domain$arg_city";fastcgi_cache_valid 200 3m;fastcgi_cache_min_uses 1;fastcgi_cache_use_stale error timeout invalid_header http_500;fastcgi_temp_path /tmp/ngx_fcgi_tmp;include fastcgi.conf;fastcgi_pass unix:/dev/shm/cae_webdev.socket;}默認均匹配
location / {include fastcgi.conf;fastcgi_pass unix:/dev/shm/cae_webdev.socket;}TCP相關
sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_requests 64;keepalive_timeout 10;PHP HHVM容錯配置
location ~ \.php$ {include fastcgi.conf;fastcgi_pass 127.0.0.1:9090;#for 500/502 error change it to php-fpmerror_page 500 502 = @fallback_fpm;}location @fallback_fpm {include fastcgi.conf;fastcgi_pass unix:/dev/shm/cweb_php.socket;}重定向配置
if (!-e $request_filename) {rewrite ^(.*)$ /index.php?$1 last;}try_files $uri /index.php$is_args$args;- 注意盡量不要用if
- rewrite不改變當前$uri的值,也就是多個rewrite時,$uri的值始終只有初始一個
- try_files會修改全局變量$uri的值
- location是有順序的,rewrite的優先級可以認為比location高
?
轉載于:https://www.cnblogs.com/leby/p/4586973.html
總結
以上是生活随笔為你收集整理的关于nginx配置的不完全总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基础学习总结(五)---baseAdap
- 下一篇: The Pilots Brothers'