我正在写一个厨师食谱来安装nginx和Phusion Passenger等。 简短的总结是,我的运行列表上的食谱没有按照我预期的顺序执行,这导致apt套件安装失败,我不知道如何解决。 整个序列有点复杂,我会尽我所能保持基本的细节。 我有我自己的配方, lr-web用于定制Web服务器到我想要的状态。其中一个动作是对nginx.conf进行更改。 我还有一个angular色来编排总体configuration,其运行列表是: "run_list":[ "recipe[apt]", "recipe[nginx]", "recipe[passenger]", "recipe[lr-web]" ] 而且, lr-web配方在其metadata.rb列出了passenger和nginx作为依赖关系。 apt和nginx食谱是标准的OpsCode。 但是我写了自己的passenger配方,因为OpsCode使用rubygems来安装乘客,但是这个版本不再支持。 遵循modrails.com的build议,通过apt来安装,我的passenger食谱中有以下步骤: cookbook_file "/etc/apt/sources.list.d/passenger.list" do source "passenger.list" mode 600 action :create_if_missing end bash "apt-get-update" do user "root" code <<-EOF apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 561F9B9CAC40B2F7 apt-get install apt-transport-https ca-certificates apt-get update EOF end apt_package "nginx-extras" do action :install end […]
我有一个redirect强制https: server { listen 80; server_name example.com; return 301 https://example.com$request_uri; } 很好的工作,但我希望能够通过使用echo模块的 http命中一个单一的文本文件: server { listen 80; location /ping { echo "http_pong"; } server_name example.com; return 301 https://example.com$request_uri; } 不幸的是我永远不能/ping因为我得到了301redirect。 我怎样才能防止全局redirect应用到单一的位置?
这个nginx实例的目的是让GitLab和OpenWRT Luci通过一个反向代理redirect。 它已经为其他几个网站工作,所有这些网站都有一个基本的url,似乎对付这个问题。 本例中的GitLab在端口9000上的本地服务器上。 nginx网站在8080端口上。 OpenWRT具有完全相同的问题,但使用/ cgi-bin / luci / 示例位置的相关nginxconfiguration是; location /gitlab/ { proxy_pass http://127.0.0.1:9000/; proxy_redirect default; } 请注意,结果是相同的和没有一个结尾的斜线。 有一些头代理configuration选项被应用到这个位置。 # Timeout if the real server is dead proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; # Basic Proxy Config proxy_set_header Host $host:$server_port; proxy_set_header Origin $scheme://$host:$server_port; proxy_set_header Connection $http_connection; proxy_set_header Cookie $http_cookie; proxy_set_header Upgrade $http_upgrade; […]
在一个nginx的conf文件中,有没有什么办法可以指定include到另一个conf文件相对于当前的conf文件? 我想写: server { listen 80; server_name localhost; include "../apis/basic.conf"; … }
我试图在我的Ubuntu 15.10上安装最新的nginx版本(1.99)。 我想要一个nginx版本> = 1.95,因为我喜欢有http 2的支持。 我遵循我在互联网上find的指示ubuntu 14.04,但应该是相同的Ubuntu 15.10( http://www.liberiangeek.net/2014/10/install-latest-version-nginx-ubuntu-14-10 / ): 下载Nginx存储库authentication密钥: cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key 安装存储库密钥: sudo apt-key add nginx_signing.key 为Nginx创build一个新的存储库文件 sudo nano /etc/apt/sources.list.d/nginx.list 然后复制并粘贴下面的行到文件中并保存(“wily”是我的15.10 Ubuntu版本的Ubuntu代号) deb http://nginx.org/packages/mainline/ubuntu/ wily nginx deb-src http://nginx.org/packages/mainline/ubuntu/ wily nginx 但是当我终于执行命令时: apt-get install nginx 我得到了以下错误: nginx : Depends: libc6 (>= 2.14) but 2.13-38+deb7u8 is to be installed Depends: […]
我将nginx设置为泊坞窗容器中的反向代理,以链接到容器外部的站点。 我有一个虚拟主机configuration设置如下(我尝试添加^家庭助理的位置之前): server { # simple reverse-proxy listen 80; location / { proxy_pass http://192.168.1.99:6789; } location ^~ /home-assistant { proxy_pass http://192.168.1.99:8123/; } location /calibre-web/ { proxy_pass http://192.168.1.99:8181/; } } 对于家庭助理和口径网站,页面加载,但我得到404错误的所有其他项目(图像,CSS等)。 如果我尝试点击应用程序中的链接,它将链接到192.168.1.99 /文件,而不是192.168.1.99 / site-folder /文件 。 以下是日志中的一些logging(注意一个200响应和其他404响应)。 我在这里做错了什么? 先谢谢您的帮助。 192.168.1.6 – randy [15/Aug/2016:03:15:42 +0000] "GET /frontend/panels/dev-template-0a099d4589636ed3038a3e9f020468a7.html HTTP/1.1" 404 199 "http://192.168.1.99/home-assistant/" "Mozilla/5.0 (X11; CrOS x86_64 8350.60.0) […]
我们有运行nginx 7.65和fastcgi PHP5的web服务器,并正在研究caching的可能性,以加快内容交付和降低系统负载。 服务器运行不同的(自定义)应用程序。 有这么多的caching选项我不知道什么是一个理智的设置。 有memcached,APC,Nginx的fastcgi_cache,proxy_cache …. 我知道memcached具有分发能力作为奖励,但我们现在不需要它。 根据我的经验,如果memcached安装在与服务器相同的机器上,其执行速度会比APC慢,但这是前一段时间。 我不熟悉Nginx的fastcgi_cache甚至是常规的proxy_cache模块。 它可比较还是完全不同? 对于Nginx w来说,一个好的,理智的caching方法是什么。 FastCGI PHP5?
问题是:我在欧洲有一台Linux服务器,使用nginx + php-fpm服务于一个繁忙的Drupal站点,在美国有另一台Linux服务器(我的访问者很大一部分来自这个服务器)。 第二台服务器严重不足。 我想知道如何使用第二台服务器来提供我的网站的静态内容?
我们使用Nginx作为Rails应用程序的负载平衡器。 由于我们正在转向多路由器托pipe解决scheme,因此我们希望负载均衡器在将请求转发到前端时为每个连接开始使用SSL,因为其中一些可能会通过互联网。 我面临的问题是非https页面创build了一个redirect循环。 这似乎是由于X-Forwarded-Proto头部设置不正确而造成的。 所以当rails在http上获取请求时,它认为这是一个https请求,即使它不是,所以它redirect到http,它认为它是一个https请求等等。 谷歌search量似乎没有帮助我解决这个问题。 所以我想知道: 这是由NGINX支持(我认为是) 我的configuration有问题吗? 我的方法在概念上有什么问题吗? 谢谢! user www-data; worker_processes 2; events { worker_connections 1024; use epoll; } http { passenger_root /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.2; passenger_ruby /opt/ruby-enterprise/bin/ruby; passenger_pool_idle_time 0; passenger_max_pool_size 20; # Over all apps passenger_min_instances 5; # Over each app passenger_use_global_queue on; rails_env production; include mime.types; default_type application/octet-stream; log_format main '"$remote_addr", "$remote_user", "$time_local", […]
标题说了这一切,但我有一个非常有趣的问题,我很困惑。 基本上,我有一个简单的WordPress安装,我想拒绝一个文件夹(连同文件夹中的所有文件),让我们说/ wp-content / themes / default / scripts,但允许某些IP。 我可以拒绝这个文件夹的位置^~/wp-content/themes/default/scripts {deny all;}就像任何Nginx的大师会告诉你的一样。 但从我的理解,“^”具有更高的优先级,一旦find正则expression式匹配,将停止search其他位置块。 因为我不想拒绝每个人的文件夹(当然,使用allow (IP Address); ;,我的^~/wp-content/…位置块完全wh出我的PHP-FPM位置块来通过文件到FastCGI服务器。当然,当我试图查看文件夹中的任何文件时,PHP文件是直接下载,因为PHP不parsing它。 有没有人有一个想法? 我想阻止该文件夹,但为了让PHP同时为我决定允许的用户工作。 这是一个相当棘手的问题。 我找不到任何问题的答案。 多谢你们! 真的很感谢你的帮助! 对于任何人想知道,我现在的Nginx的vhostconfiguration如下所示: server { #..all of the common stuff you would expect include /folder/nginx.conf; #including some WordPress rewrites for W3 Total Cache # pass the PHP scripts to FastCGI server listening on UNIX […]