我有一个与fastcgi通过nginx托pipe的django项目。 Django有一些用户使用西里尔文字符。 但是当我试图用这样的链接打开页面时,django告诉它没有这样的模型,因为链接被跳过了,并被带到django中,成为“%D0%BA%D0%BD%D0%B8%D0%B3 %D0%B8" 。 在Apache的同一个项目工作正常。 我需要什么样的select来告诉nginx不要逃避这样的链接?
我试图确定文件是否被成功下载或取消,按照这篇文章http://www.tipstuff.org/2012/08/Nginx-post-action-to-trigger-successfully-download-file.html 我做的一切都一样,但我想在同一台服务器上的proxy_pass,而不是不同的(如在这个例子是代理从nginx到Apache),它甚至有可能吗? 看着访问日志,它的行为就像没有给我任何回应,我正试图下载一个100MB的文件/file.bin,谢谢你的每一个build议! Nginxconfiguration server { listen 80; server_name www.somepage.com; access_log /var/log/nginx/www.somepage.com.access_log; error_log /var/log/nginx/www.somepage.com.error_log; root /var/www/www.somepage.com; index index.php index.htm index.html; location / { post_action @afterdownload; } location @afterdownload { proxy_pass http://www.somepage.com/test/test.php?FileName=$request&ClientIP=$remote_addr&body_bytes_sent=$body_bytes_sent&status=$request_completion; internal; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /var/www/www.somepage.com$fastcgi_script_name; include fastcgi_params; } } 和/test/test.php插入到MySQL的值: <?php require_once('../database.php'); mysqli_query($con, "INSERT INTO downloading (info) VALUES […]
我试图用简写打开和closures标签来configurationnginx。 目前下面的代码工作,例如: <?php include('this.php'); ?> 但是这不是: <? include('this.php'); ?> 有没有办法configuration这个,所以它可以工作吗?
我有以下设置: server { server_name some.server; location / { rewrite ^ https://otherserver.com permanent; } } redirect按预期工作,但发送到第一个请求的Authorization标头不会发送到其他服务器。 我怎样才能解决这个问题?
我承认跑了这个: sudo update-rc.d nginx defaults 这似乎消灭了nginx的设置。 像sudo service nginx start这样的Nginx命令在执行时不再返回任何东西。 但是,我的django应用程序的nginx文件仍然存在于: sudo vim /etc/nginx/sites-enabled/myapp sudo vim /etc/nginx/sites-available/myapp 我在nginx上运行了一个GREP,得到: /etc/nginx/sites-available/myapp包含: server { server_name ec2-xxxx.compute-1.amazonaws.com; access_log /home/ubuntu/virtualenv/myapp/error/access.log; error_log /home/ubuntu/virtualenv/myapp/error/error.log warn; connection_pool_size 2048; root /home/ubuntu/virtualenv/myapp/homelaunch/; location /static/ { alias /home/ubuntu/virtualenv/myapp/homelaunch/static/; #alias /static/; #root /home/ubuntu/virtualenv/myapp/homelaunch/; } location / { proxy_pass http://127.0.0.1:8001; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-Host […]
这是关于使用子域的示例Rails应用程序。 你可以在这里访问它: http : //rodrigora.com.br 。 在这个应用程序中,您可以创build网站并为其指定一个子网域。 例: 网站: Google 子域名: gog 这个网站应该可以访问http://gog.rodrigora.com.br 但是,该应用程序是不可缓解的任何子域名,无论是www 。 DNS服务器configuration: nginx服务器configuration: upstream app_server { server unix:/tmp/unicorn.blog.sock fail_timeout=0; } server { listen 80 default; #server_name localhost; client_max_body_size 4G; keepalive_timeout 10; root /home/ubuntu/apps/blog/current/public; try_files $uri/index.html $uri.html $uri @app; location @app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; […]
今天早上,我们有一个爬虫在我们的服务器上每秒钟跳到我们的网站几乎100次。 我们想为此添加保护。 我想我必须使用HttpLimitReqModule,但我不想阻止允许谷歌/ BING / …我应该怎么做?
我有一个网站,请求一个特定的JSON文件,发现它缺less触发一个后备JSON文件的请求。 但是,而不是得到第一个文件的404,我得到的index.html ,这是不是有效的JSON的内容,并创build一个错误。 我把这个问题追溯到这个指令: location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } 我怎样才能得到它的mysite.com/some/nonexistent/file.json 404 ,但仍然得到index.html的mysite.com/ ?
我已经沮丧了几天想弄明白这一点,所以任何意见/帮助将不胜感激! 我最近在somehost.com上添加了一个名为/links到某个站点的部分,但似乎无法得到这个目录的重写规则(见下文)。 域的所有其他path工作正常(例如说一些hosthost /浏览器/video/无论redirect到somehost.com/by/whatever/罚款)和所有其他重写规则似乎仍然工作很好,这只是新添加location /links/部分我的conf在东西分崩离析。 下面的conf在第27行失败 – 使用service nginx restart时得到的错误是: 指令“rewrite”没有以“;”结尾。 但是我可以看到终点线终止于一个; 所以我不确定有什么问题。 也许正则expression式的东西? 我的nginx conf在下面。 任何想要改变什么来获取像somehost.com/links/page/3或somehost.com/links/tag/sometopic/page/2工作的url? 谢谢! server { server_name somehost.com; listen 80; root /var/www/somehost.com; include /etc/nginx/php.conf; location / { index index.php; access_log /var/log/nginx/somehost.com.log; #handle old variable redirects first, before dealing with current permalinks rewrite ^/?browse/video/(.*) /by/$1 permanent; #set a 30-day expires header on […]
我一直在这个工作了一段时间,似乎无法find任何解决scheme。 我坐在我的nginx服务器前面的清漆,CloudFlare坐在前面。 当我发出一个curl -X PURGE主机时,CloudFlare会挑选它,当然会拒绝503错误。 如果我使用direct.host来绕过CloudFlare,它会触发Varnish服务器,并接受请求,但它不会执行任何操作,因为不使用direct.host,所以caching中没有任何内容。 我使用的是WordPress,并且有一个WordPress Varnish Purge插件,它说要将以下行添加到wp-config.php : define('VHP_VARNISH_IP','127.0.0.1') 这是特别与代理服务器和/或CloudFlare,以确保请求去清漆服务器而不是CloudFlare,但似乎没有帮助。 任何人以前看到这个,有什么想法?