我试图在nginx上实现一个节streamfunction,跨多个数据中心跨多个服务器共享。 我想知道什么是build设这个最好的做法。 例如,假设我有一个HTTP API运行在位于两个不同数据中心的两个服务器集群(负载均衡器后面)上。 我想通过他的api-key将开发人员压缩到每小时1000个请求。 开发人员已经构build了一个移动应用程序,这意味着取决于他的最终用户的位置,请求将由两个位置(最近的数据中心)服务器。 你将如何在这个特定的情况下执行限制?
(xxxxx) – >redirect到xxxxauth.domain.edu – >的任何传入请求,该请求对用户进行身份validation并redirect回xxxx服务器。 (使用Cookie设置,在我的情况下,这是EZproxy服务器做cookie设置) 我已经尝试重写请求url,并使用proxy_pass booth导致循环错误(从浏览器)错误。 我一定会错过一些基本的标题,或者从昨天上午以来我无法得到什么。 有关如何configuration必须的任何build议?
在一个空的VPS主机上,我设法使用Apache2和LDAP运行基本的iRedMail安装,我的roundcubemail可以在以下地址访问: https://www.mydomain.com/mail 然后我安装了NginX,closures了Apache2,重新configuration了iRedMail(在DNS条目中没有添加任何额外的Alogging),并设法在Nginx基础安装上运行它,以及可以在以下地址访问的roundcubemail: https://mail.mydomain.com 现在,我想运行带有roundcubemail的基础iRedMail Apache2安装的Nginx反向代理,请访问: https://mail.mydomain.com 我有点卡住下面的Apache2configuration文件: /etc/apache2/ports.conf 听8080 /etc/apahce2/sites-available/my-iredmail.conf <VirtualHost *:8080> DocumentRoot / var / www / ServerName mail.mydomain.com 别名/“/ usr / share / apache2 / roundcubemail /” <Directory "/usr/share/apache2/roundcubemail"> 选项索引FollowSymlinks MultiViews AllowOverride全部 订单允许,否认 全部允许 </Directory> </VirtualHost> 并遵循NginXconfiguration文件: /etc/nginx/sites-available/default 服务器{ 听80 default_server; 听[::]:80; root /usr/share/nginx/html; index index.html index.htm index.php; server_name mydomain.com www.mydomain.com mail.mydomain.com; […]
我有一些麻烦,让我的nginx设置工作的方式,我想要的。 我有一个站点example.localhost位于/ vagrant / frontend / www。 我的configuration,这是工作,看起来像这样: server { listen 80; server_name example.localhost; root /vagrant/frontend/www; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include /etc/nginx/fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } } 但是,我想添加一个pipe理网站,位于/ vagrant / backend / www,到地址example.localhost / admin。 我的设置是这样的: location /admin { alias /vagrant/backend/www/; try_files $uri $uri/ /index.php?$args; location […]
我遇到了一个nginx的proxy_pass问题,并且在nginx的wiki上对HttpProxyModule文档进行了详细的介绍,但是无法弄清楚。 我有一个本地主机(127.0.0.1:9001)上运行的主pipe( http://supervisord.org/ )和nginxredirect从端口80到443的所有stream量。我希望能够进入pipe理员状态页面时我去https://mydomain/supervisor 。 我的nginx.conf文件的相关部分看起来像这样 – server { listen 80; server_name mydomain; return 301 https://$host$request_uri; } server { listen 443; server_name mydomain; # .. bunch of ssl stuff location /supervisor/ { proxy_set_header Host $host; proxy_pass http://127.0.0.1:9001/; } } 这很好,当我去https://mydomain/supervisor ,我得到supervisord状态网页。 但是,当我点击“刷新”链接(在页面上,而不是浏览器刷新)或启动/停止一个进程,然后我被发回到一个页面,如http://mydomain/?message=Process app started ,这只需要我到一个nginx的初始屏幕,而不是监督页面。 我已经在页面上检查过html源代码了,它给了我相关的链接。 所以这似乎是在我的configuration中剥离/ supervisor /,我只是不知道是什么。 谢谢,
我在我的实验室里把Apache改成了Nginx,我们在子域下有很多projets,所以我用一种方法,每个子目录的服务器都运行在一个高端口(8000或者更高),而主服务器在80代理他们。 我的80服务器是这样configuration的: include /etc/nginx/sites-enabled/*.conf; upstream php { server unix:/run/php-fpm.sock; } server { server_name example.com; listen 80; location / { proxy_pass http://127.0.0.1:8000; } location /application { proxy_pass http://127.0.0.1:8001; } location /phpmyadmin { proxy_pass http://127.0.0.1:8002; } } 所以我有另外三个服务监听不同的端口,如下所示: server { listen 8000; root /var/www/path/to/application; index index.php; location / { try_files $uri $uri/ /index.php?$args =404; } location ~ […]
我有3个域名,1个服务器和1个IPv4和1ipv6。 我已经创build了一个logging到我的ipv4(我现在不使用IPv6)。 我的3个网站使用Wordpress。 我为一个域configuration了Nginx和php-fpm。 /etc/nginx/conf.d/php5-fpm: upstream php5-fpm-sock { server unix:/var/run/php5-fpm.sock; } /etc/nginx/sites-available/domain.com.conf: server { listen 80; server_name domain.com; root /var/www/domain.com; index index.php index.html; #charset koi8-r; access_log /var/log/nginx/domain.com.access.log; error_log /var/log/nginx/domain.com.error.log; #include global/common.conf; #include global/wordpress.conf; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_index index.php; fastcgi_pass php5-fpm-sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; […]
我几个小时前刚刚和Laravel一起玩过,好像打了一堵墙。 我的nginx文档根目录是usr/share/nginx/html/ 。 在这个文件夹里我有一个index.php (显示phpinfo(); )和一个Laravel 4项目,位于文件夹helloworld 在Laravel helloworld项目中,我有一个像这样的routes.php Route::get('/', function() { return 'hello world'; }); Route::get('about', function() { return 'this is about'; }); 浏览到localhost/helloworld/public/ ,它展示了hello world ,这是正确的。 但是浏览到localhost/helloworld/public/about ,它显示了index.php在文档的根html而不是显示this is about 看来我错误地configuration了一些东西。 这是我的nginx的default.conf 请帮忙。 先谢谢你。
我在Mac上的nginx.conf有以下几行: location /addPat { resolver 8.8.8.8; proxy_pass http://some_url:8080$request_uri; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } 这是从运行Debian的同一networking上的一台机器上直接复制而来的。 没有区别。 但是,虽然该指令在Linux上完美工作,它不断返回我的Mac上的404; 和日志条目是这样的: 2014/05/12 17:04:35 [error] 437#0: *13 "/usr/local/Cellar/nginx/1.4.6/html/addPat/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /addPat/ HTTP/1.1", host: "localhost" 这是非常烦人的,因为当你期望它可以在所有平台上工作时,它似乎不一致。 这里有什么问题?
在Apache中,我们有一些很好的解决scheme来限制每个虚拟主机的带宽使用,比如mod_bandwidth。 但是,自从我开始使用nginx之后,我无法find限制和监视每个服务器块的带宽使用情况的方法。 我想听听有关监控和限制nginx上每个服务器块的带宽使用情况的一些build议。