我有这个文件夹:/ home / sites / dev / Nginx服务这个文件夹的内容,如果我访问“domain.com” 但是,让我们说,如果我在这个文件夹内创build一个文件夹,例如“wp-test”,我想让nginx服务这个文件夹,如果我访问“wp-test.domain.com” 看起来像“ianc”使他的博客文章工作 ,但我不能得到它的工作。 这是我的configuration到目前为止nginx: server { listen 80; server_name www.ilundev.no; root /home/sites/dev; } server { listen 80; server_name ~^(.*)\.ilundev\.no$; if (!-d /home/sites/dev/ilundev.no/public/$1) { rewrite . http://www.ilundev.no/ redirect; } root /home/sites/dev/$1; } server { listen 80; server_name ilundev.no; rewrite ^/(.*) http://www.ilundev.no/$1 permanent; }
我如何处理日志文件(在我的情况nginx access.log)以相反的顺序? 背景我正在开发一个日志文件分析器脚本,我只是无法得到我的头如何从最后处理大型日志文件,所以我可以整理出我需要的最新date的时间框架。
要匹配具有特定扩展名的文件,我们可以使用这个 location〜。*。(php | jsp | cgi | pl | py)?$ {} 和所有预期的一样 但是,如果我们有没有任何扩展名的文件,我怎么能匹配他们在“位置”块?
我想通过查找静态文件直接在我的应用程序caching某些URL。 但是,静态caching的文件可能不存在,所以我只想redirect请求,如果文件存在。 我想我可以使用try_files来做这件事,但到目前为止,我还没有成功地做到这一点。 这是我的尝试: location ^/(.*)/(.*)/other/stuff/(.*)/this-is-static { try_files /static-cache/$1/$2/$3/this-is-static @app; } static-cache是在同一文件中configuration的内部位置。 这似乎没有按预期工作。 怎么了? 我得到的最接近的是这个,它重写了每一个请求(当文件没有被caching时失败): location ^/(.*)/(.*)/other/stuff/(.*)/this-is-static { rewrite ^ /static-cache/$1/$2/$3/this-is-static; }
我有用户提交的文件,我试图上传10 MB块。 我目前正在使用原始的XMLHttpRequest(和XDomainRequest)在前端推送每个单独的切片( File.prototoype.slice )。 后端是使用上传模块的 Nginx。 仅供参考,以下是我如何使用slice的概要: element.files[0].slice(…) 我了解跨浏览器前缀的方法webkitSlice和mozSlice等等。 我遇到的问题是实际进行跨域请求。 我从server.local上传到upload.server.local 。 在Firefox中, options请求正常,然后实际post失败。 在Chrome和Opera中, options请求失败 OPTIONS https://URL Resource failed to load 以下是Firefox的标题: 请求头 OPTIONS /path/to/asset HTTP/1.1 Host: upload.server.local:8443 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Origin: https://server.local:8443 Access-Control-Request-Method: POST Access-Control-Request-Headers: content-disposition,content-type,x-content-range,x-session-id Connection: keep-alive Pragma: […]
组态: Nginx作为反向代理+ SSL协商 Apache Tomcat。 似乎一切正常,除了file upload。 由于某种原因file upload永远不会完成。 通过下面列出的configuration,我可以上传小文件(4K)。 上传失败的194K文件。 当我将“client_body_buffer_size”增加到256K时,我可以上传194K文件,但是一个500Kfile upload失败。 增加超过256K的“client_body_buffer_size”没有任何影响。 注意:当我直接访问Tomcat并上传500K文件时,它在几毫秒内完成。 所以,Nginxconfiguration看起来有点不对劲。 任何build议,非常感谢。 upstream tomcat_server { server 127.0.0.1:9090 fail_timeout=0; keepalive 16; } location / { root /xyz; proxy_http_version 1.1; proxy_pass http://tomcat_server; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffering on; proxy_connect_timeout 75; proxy_send_timeout […]
我有这个Node.js应用程序由Nginx(生产)代理。 路线是这样的: exports.download = function(req, res){ var id = req.params.id; if (id && id == 'latest') { res.download(config.items.release_directory+'/<1.6GB-file>.zip', function(err){ if (err) { console.log(err); } else { // do something } }); } else { res.redirect(301, '/'); } }; 所以,点击正确的路由/ URL浏览器开始下载大文件,但它总是停在1.08GB(该文件约为1.6GB),截断它。 我真的不明白为什么。 有任何想法吗? 编辑:config.items.release_directory是一个静态Express目录声明为: app.use('/releases', express.static(path.join(__dirname, '..', 'releases'))); 编辑2:在开发与咕噜直接服务没有Nginx的应用程序,它工作正常。 已解决:阅读下面的注释,问题是Nginx中的proxy_max_temp_file_sizevariables
所以,虽然SVG是可缩放和可浏览的 ,看起来凌乱,但一般: 在PDF文件中 Include dependency graph (第195页)看起来确实很乱: 我自动生成我的documentatoion 在Linux上通过这样的脚本通过像这样的命令: doxygen cd release/latex/ pdflatex refman.tex makeindex refman.idx pdflatex refman.tex 这为我生成HTML和PDF文档。 我如何改变我的doxygen文件或脚本,以便在我的tex / PDF文件中没有“包含依赖关系图”,同时仍然将它们放在HTML文档中?
我无法理解我的程序行为。 int MyOpenWrite(char *name,int flags) { int fd; unsigned long tm; unsigned long t; tm=time(0)+5; //5 seconds for (;;) { fd = open(name,flags,S_IREAD|S_IWRITE|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); if (fd>0) break; if (time(0)>=tm) return -1; } //1111111111111111111 LockFile(fd); DelayInSeconds(60); //2222222222222222222222 return fd; } int LockFile(int fd) //return 0 – OK; -1 – Error { struct flock lock; lock.l_type = F_WRLCK; […]
当我尝试检查可执行文件的types时,我总是得到这个: symbolic link to <another_file> 然后我必须进一步挖掘并运行file <another_file>. 有时这可能需要5或6轮。 我想知道是否有办法让文件recursion地去原来的文件,并告诉我的文件types。