如何通过特定的端口或简单的指定文件夹来禁用nginx超时。 无论哪一个更容易。 基本上我有一些脚本需要执行很长一段时间,网关超时阻止它们完成。
我有一个非常基本的nginx设置,将www.example.comredirect到example.com ,遵循最佳实践 。 它的工作原理,并在Tor火狐浏览器,去http://www.idorecall.com/blog确实更新地址栏中的urlhttp://idorecall.com/blog 。 但这并不会改变Chrome,Firefox Portable,IE和Opera Portable的地址栏中的url。 这是修改后的default nginxconfiguration。 除nginx.conf之外,没有其他的nginxconfiguration文件。 server { server_name www.idorecall.com; return 301 $scheme://idorecall.com$request_uri; } server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name idorecall.com; location / { try_files $uri $uri/ =404; } location /blog { proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_pass http://127.0.0.1:2368; } […]
我反复在我的nginx日志中看到这个错误: [crit] 30165#0: ngx_slab_alloc() failed: no memory in cache keys zone "api-data-cache" 看看用于caching关键区域的目录,我可以看到它在326MB标记附近徘徊: du -s /usr/local/nginx/cache/ 326652 然而,我的nginx.conf指定1GB的max_size ,这意味着应该有足够的空间: proxy_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=api-data-cache:8m max_size=1g inactive=600m; proxy_cache_key "$scheme$host$request_uri/$device_type$cookie_w3tc_referrer"; proxy_cache_use_stale updating timeout http_500 http_502 http_503 http_504; proxy_ignore_headers X-Accel-Expires Expires Cache-Control; 这里可能会发生什么? 有大量的磁盘空间可用(> 50GB的免费),并没有find任何相关的文件 ,我有点损失。
我有以下的nginxconfiguration: server { listen 8080; root /site_root/web; index index.html; server_name www.mysite.com; location / { try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } # add headers to static files location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff|ttf|eot)$ { expires 365d; add_header Pragma public; add_header Cache-Control "public"; } location ~ \.php { fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param PATH_TRANSLATED […]
我最近把nginx更新到了1.9.7,它支持http2。 当在我的一个虚拟主机中启用http2时,每一个nginx应该从那个虚拟主机提供的页面被下载。 我在最新版本的Chrome,Safari和Chrome for Android上进行了testing。 所有下载和保存导航到的页面名称都有相同的结果,即使页面实际上并不存在于服务器上。 保存在计算机上的页面从不包含服务器上的实际内容。 这是一个奇怪的文件,包含相同的,奇怪的1kbstring)。 我试着testing不同的扩展名,以确保它不是一个php-fpm,下载的每个扩展的问题。 虚拟主机configuration: server { listen <ip>:80 http2; server_name testsite.dev; index index.php index.html index.htm; root /home/sites/test/www; access_log /var/log/nginx/sites/testsite-access_log; error_log /var/log/nginx/sites/testsite-error_log; # location / { # try_files $uri $uri/ /index.php; # } location = /favicon.ico { access_log off; log_not_found off; } gzip off; location ~ \.php$ { try_files $uri […]
每隔一段时间,我的Rails服务器停止响应。 我尾巴的日志,没有什么 – 只是一堆请求已经开始后,最后一个完成… 运用 Ubuntu的 彪马2.15.3 Ruby 2.2.1p85 NGINX 1.4.6 主pipe(运行/ respawning导轨服务器&sidekiq) Rails日志… Completed 200 OK in 179ms (Views: 6.2ms | ActiveRecord: 165.7ms) Started OPTIONS "/api/v2/users/me" for 209.217.218.34 at 2015-12-16 21:43:47 +0000 Started OPTIONS "/api/v2/users/me" for 209.217.218.34 at 2015-12-16 21:44:21 +0000 Started GET "/" for 209.217.218.34 at 2015-12-16 21:45:11 +0000 Started GET "/" for […]
我刚刚在Archlinux盒子上安装了nginx,并遇到这个问题: Nginxconfiguration为在/etc/nginx/nginx.conf作为“nginx”运行,我添加了一个新的用户/组: user nginx nginx; 对于双重检查: $ ps aux | grep nginx nginx 9678 0.0 0.5 28472 2856 ? S 17:37 0:00 nginx: worker process nginx 9679 0.0 0.5 28472 2856 ? S 17:37 0:00 nginx: worker process root 31912 0.0 0.6 28084 3364 ? Ss 17:24 0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; […]
我已经看了网上的其他几十个问题和参考 – 而且通过我所有的计算,我的设置应该可以工作,但是不能。 我有php-fpm的nginx安装。 如果我尝试访问一个.php文件,它运行正确,我得到正确的结果。 我在我的configuration文件中得到这个: location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } 现在,我想设置我的networking应用程序,以便/somedir/file自动执行/somdir/file.php同时仍然在浏览器的地址栏中显示/somdir/file 。 所以我修改我的configuration来包含以下内容: location / { try_files $uri $uri/ $uri.php?query_string } 这种工作,也就是服务器访问.php文件。 然而,不是使用上面现有location ~ \.php$块来执行它,而只是将php源代码作为下载到浏览器中。 如果我手动追加.php到所请求的URL,那么PHP被执行。 感觉就好像服务器把try_files和$uri.php匹配$uri.php ,然后就不会在位置做另一个传递来看看它需要做什么。 我试图把php块放在location /上面和下面,但是没有什么区别。 我怎样才能得到执行的PHP?
那么我有一个比这个稍微不同的问题 :我不想同时映射两个variables,我想映射一个variables使用另外两个参数。 事实上,我已经阅读了关于地图指令的文档 : 在版本0.9.0之前,只能在第一个参数中指定一个variables。 所以,因为我有nginx 1.8,我希望能够在第一个参数中使用多个单个variables。 这导致我认为我可以在这个例子中写下类似于最后两个map指令的东西: map $http_user_agent $bot { default ""; "~*Googlebot" "yes"; "~*MJ12bot" "yes"; "~*bingbot" "yes"; etc. } map $request $bot $np { default "" ""; default "yes" ""; "~*newproject" "" "yes"; "~*newproject" "yes" ""; } map $bot $np $regular { "" "" "yes"; "" "yes" ""; "yes" "" ""; } […]
我有nginx代理,我想所有的请求被代理到另一台服务器与相同的URI。 以下是我所做的: location / { proxy_pass https://example.com; } 但我需要在这个规则的例外 – 当url为空(用户访问实际/位置)我想代理这个请求https://example.com/index 我如何写一个空的url的规则?