在这个问题中: 在负载平衡器后面用ngnix重写http到https 问题是如何在负载均衡器之后强制使用nginx服务器的SSL。 这个设置的问题是负载平衡器处理SSL并且与web服务器/节点具有非SSL连接。 所以它看着http-x-forward-proto头。 接受的答案工作正常,除了它使用如果像这样: if ($http_x_forwarded_proto = "http") { rewrite ^/(.*)$ https://mydomain.com/$1 permanent; } 这是邪恶的: http : //wiki.nginx.org/IfIsEvil 有没有更好的方法来做到这一点,如果没有? 一个可能的解决scheme是强制ssl在负载均衡器上,但是这个负载均衡器是由我们的主机pipe理的,这使得更改变得更乏味,希望得到一个不需要改变负载均衡器的答案
我有用于服务静态文件的nginx后端。 Nginx运行在非标准的端口上(例如8080)。 它可以通过端口80上的反向代理公开访问。 该设置大部分工作正常。 但是,如果对目录发出请求,nginx将返回一个301redirect,端口设置为8080。 所有我能find的问题都是关于nginx是一个反向代理而不是实际的服务器。 任何帮助将非常感激! 为了解决这个问题,URL http://example.com/dir/工作正常。 但是留下斜杠http://example.com/dir会导致浏览器redirect到http://example.com:8080/dir 。
我已经在http指令下的nginx.conf文件中将charset设置为“utf-8”。 它看起来像这样: http { charset utf-8; } 我有两个服务器指令。 一个是example.com,一个是www.example.com。 他们看起来像这样 server { listen 80; server_name example.com; root /usr/share/nginx/html; return 301 http://www.example.com$request_uri; } server { listen 80; server_name www.example.com; root /usr/share/nginx/html; index index.html; location /{ try_files $uri $uri/ =404; } } 但是,对example.com的初始请求似乎不会在Content-Type HTTP标头之后呈现字符集types。 以下是响应标题: $ curl example.com -I –progress-bar HTTP/1.1 301 Moved Permanently Server: nginx Date: […]
我试图设置一个使用我的网站的机器人的速率限制,但如果我添加 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; 或者在包含我之前在http块中/etc/nginx/nginx.conf中的任何东西 user@srv:~$ sudo service nginx restart Restarting nginx: nginx: [emerg] unknown directive "limit_req_zone" in /etc/nginx/nginx.conf:11 我不明白为什么这是或在哪里寻找问题… 任何帮助感激!
我有一个PHP应用程序在本地主机端口80上运行,另一个在端口81上运行。 指向浏览器http://localhost运行第一个应用程序及其所有资产:js,css,imgs在/assets文件夹中。 但是,第二个应用程序只能提供具有确切文件名的资产作为第一个应用程序。 如果第二个应用程序的资产位于第二个应用程序的/assets目录中,并且与第一个应用程序/assets文件夹中的文件名称不同,则会发现这些文件没有find404错误。 以下是关于我所看到的更多细节: http://localhost <script src='/assets/foo.js'></script> //file contents alert('foo'); when foo.js is in app #1's /assets directory http://localhost:81 <script src='/assets/foo.js'></script> alert('foo 2'); //alerts "foo 2" when foo.js is in app #2's /assets directory <script src='/assets/bar.js'></script> //file contents: alert('bar'); //file not found 404 error when bar.js is in app #2's /assets directory 在我的nginx.conf可能的原因是: http […]
我有一台服务器,安装VestaCP(apache2是后端,nginx是前端)。 另外,我成功安装了ruby,gitlab shell和gitlab。 当我input sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production 一切都显示OK。 还有一个问题 – 为它configuration服务器。 我试图把这个复制到新的模板,但是apache2在它之后不会启动。 现在我有一个由vestacp和gitlab提供的干净的Web服务器安装,所以它不需要“修复”Apache2服务器。
突然在这个VPS的所有网站停止响应。 服务器已启动,内存使用情况正常。 但在Nginx错误日志中看到这个: 2014/07/20 07:10:24 [alert] 13671#0: worker process 15020 exited on signal 5 (core dumped) 2014/07/20 07:15:11 [alert] 13671#0: worker process 16327 exited on signal 5 (core dumped) 2014/07/20 07:15:11 [alert] 13671#0: worker process 16036 exited on signal 5 (core dumped) 2014/07/20 07:15:11 [alert] 13671#0: worker process 16369 exited on signal 5 (core dumped) […]
我正在尝试将服务从服务器迁移到另一个服务器。 这是一个简单的php应用程序。 在第一台服务器( Apache )上,我可以通过以下方式请求一个JSON : my.vhost.myDomain.tld/apps?query=toto¶ms=aparam 在第二个( nginx )上,我应该可以用同样的方法来做: my.vhost.myOtherDomain.tld/apps?query=toto¶ms=aparam 两个应用程序都包含一个由两个Web服务器正确提供的index.php 。 但是, /apps? 在nginx上产生一个404。 我的猜测是, Apache正在寻找一个php文件来处理查询。 然而,我对这个工具是一个小菜鸟,我不明白在Apache服务器上发生了什么,以及如何configurationnginx重现相同的行为… 是index.php文件作为input处理? 到目前为止,我试图指定my.vhost.myOtherDomain.tld/index.php/apps?query=toto¶ms=aparam成功。 并没有太多的帮助,探索Apacheconfiguration文件。
我有一个nginx服务器集,它代理基于Host字段的请求。 我有一个共同的日志,因为每个主机日志logging是在服务器上完成的,我做了proxy_pass。 那么,是否有解决scheme来分析和查看组合统计数据? 迄今试过: AWStats软件 Webalizer的 goaccess 游客 所有列出的解决scheme都要求我为每个站点生成单独的报告(可能来自一个日志)。 我想看看我所有的虚拟主机access.log的完整报告,为每个虚拟主机生成一个单独的报告是一团糟 – 有很多主机,他们正在迅速改变。 有一个半解决scheme:欺骗webalizer,并使他对待主机作为访问者。 不是非常有用的。
以下是我的nginxconfiguration文件。 它应该使/ inc和/ admin / inc内部,但我可以正常访问他们,就像行甚至不存在。 这不是给我一个外部的请求404应该。 我已经尝试过拒绝所有的 相反只是为了testing它是否匹配,但即使否认所有都没有解决。 我试过#nginx和几个系统pipe理员的朋友,我在这里提到。 server { listen 80; root /var/www; server_name localhost; location / { rewrite ^/((?i)sitemap-([^./]+)\.xml)$ /misc.php?google_seo_sitemap=$2; try_files $uri $uri/ /index.php$uri&$args; index index.php; } location /inc { internal; } location /admin { include inc/adminip; location /inc { internal; } location ~ \.php$ { include inc/php; } } error_page […]