我有一个tomcar服务器上的几个应用程序。 我正在使用nginx的代理,所以我可以实现从子域的应用程序join tomat:8080/app1 > app1.mydomain.com tomat:8080/app2 > app2.mydomain.com 我build立了一个反向代理: server { listen 80; server_name app1.mydomain.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_pass http://tomcat:8080/app1/; } } 我可以访问应用程序没有问题。 但是无法保持会话。 我在docker上有另一个应用程序,在ngix后面运行没有问题。 另外,如果我直接访问应用程序,我可以操作它没有问题。 任何提示? 谢谢。
我在本地的CentOS 6.3服务器上运行nginx。 我有一个特定的JavaScript文件加载在网页中。 如果我更改JavaScript文件,并刷新网页,我总是得到一个500错误。 然后当我再次刷新,JS文件加载得很好。 后来,如果我再次更改JS文件,并刷新浏览器,相同的500错误。 刷新第二次,它加载得很好。 它只给第一次刷新500错误。 为什么是这样? 这是我的服务器configuration: server { listen 80; server_name www.mysite.local; rewrite ^(.*) http://mysite.local$1 permanent; } server { listen 80; server_name mysite.local; access_log /var/log/nginx/mysite.local/access.log; error_log /var/log/nginx/mysite.local/error.log; rewrite_log on; root /vhosts/mysite/mysite.local/public; index index.php; # Heres my redirect, try normal URI and then our Laravel urls. location / { try_files $uri $uri/ […]
我有一些独立的Java Web应用程序,目前运行在不同的端口和URLS。 我想公开所有这些应用程序在一个单一的端口(443),并将不同的公共URL映射到单个内部URL /端口。 我认为客户端是Nginx的反向代理。 我还需要这些应用只能通过SSL进行访问,并且在AWS ELB上使用终止于AWS ELB的AWS VPC中的所有内容进行规划,然后再select反向代理。 这看起来像一个非常标准的堆栈。 有没有理由不这样做? 任何理由我应该终止反向代理(Nginx或其他)而不是AWS ELB的SSL? 谢谢
新手到Nginx和Tomcat设置。 有人能帮我理解这个错误信息的含义吗? 2014/09/21 00:10:03 [error] 293#0: *127 upstream timed out (60: Operation timed out) while reading response header from upstream, client: 192.168.10.211, server: my.server.com, request: "POST /path/dosomething.json HTTP/1.1", upstream: "http://192.168.10.11:7070/path/dosomething.json";, host: "my.server.com" 在nginx上打开debugging模式时。 2014/09/21 13:19:54 [error] 303#0: *37 upstream timed out (60: Operation timed out) while reading response header from upstream, client: — same as […]
不知道如果我试图拉下不可能的,但我想要configurationNginx服务“.webp”文件到浏览器支持文件格式和服务回退文件(即PNG,JPG等)到浏览器那还不支持WebP格式。 我也希望Nginx能够在检查视网膜支持和服务这些照片的原始或@ 2x大小的版本时做到这一切。 /assets/img/目录中称为“sample-photo”的图片的示例stream程: 检查浏览器是否支持WebP,如果是高分辨率设备,请input:“assets / img / [email protected]” 设备可能不是高分辨率,因此可以提供:“assets / img / sample-photo.webp” 也许WebP不被支持,但设备是高分辨率,所以服务:“assets / img / [email protected]” 浏览器不支持WebP和设备不是高分辨率,服务:“assets / img / sample-photo.png” 我自己刺了一下,但没有太多的运气。 我发现了两个令人敬畏的post,帮助我开始了正确的方向。 下面是我的代码。 真的很感激任何见解和帮助。 我的第一个想法是,也许在最后的try_files声明中有一些不可思议的事情发生。 非常感谢! 有条件地提供高分辨率的图像 用nginx有条件地处理文件 此代码位于我的文档的HTML头部。 检查高分辨率支持并设置一个cookie: <!– Set the 'device-pixel-ratio' cookie with Javascript if hi-res is supported –> <script type="text/javascript"> if (!document.cookie.match(/\bdevice-pixel-ratio=/)) { document.cookie = 'device-pixel-ratio=' + […]
在我的应用程序中,我有我的应用程序服务器(独angular兽)的nginx代理。 我正在努力提高我的file upload性能。 我已经通过各种技术阅读,可以防止在上传文件时阻止应用进程被阻止。 目前关于处理这个问题的最好方法的信息似乎很难(见这个问题 )。 我正在尝试使用client_body_in_file_only on; 据我了解,它告诉nginx缓冲整个请求到磁盘。 我感到困惑的是,即使没有这个指令,我在我的nginx日志中看到这个: 2014/10/10 17:41:43 [warn] 50331#0: *798 a client request body is buffered to a temporary file /usr/local/var/run/nginx/client_body_temp/0040665399, client: 127.0.0.1, server: my_site.dev, request: "POST /upload HTTP/1.1", host: "my_site.dev", referrer: "https://my_site.dev/upload" 它看起来像nginx缓冲file upload到磁盘无论如何。 nginx是不是在这里开箱即可? 我还应该使用client_body_in_file_only吗? 我误解了这里发生了什么?
我有几个暴露的JSON脚本/程序从服务器快速收集信息。 我使用nginx将这些只是原始的URL。 所以给以下位置: location ~ ^/api/status/? { rewrite ^(.*)$ /path/to/some/handler/wan.handler; } location ~ ^/api/status-lan/? { rewrite ^(.*)$ /path/to/some/handler/lan.handler; } 为什么nginx将status-lan调用与status位置匹配? 所以我可以从/api/status/查看我的输出,但是如果我查看/api/status-lan/我得到status位置。
我试图让我的Rails应用程序在我的VPS上工作。 我部署了我的项目,创build了数据库并迁移了它。 但是当我访问该页面时,我收到一条消息: We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly. 我的nginx错误日志告诉我这个: App 12380 stdout: App 12380 stderr: *** ERROR ***: Cannot execute /home/deploy/.rvm/wrappers/ruby-2.1.2/ruby: No such file or directory (2) [ 2014-11-03 11:44:12.9549 12050/7fd1a0bb8700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/deploy/wisemonkeys/current: […]
我正在为caching代理服务器设置一个Nginx服务器。 我注意到,caching不工作,当这个头在请求: Pragma: no-cache 没有这个头,caching工作正常。 我可以让Nginx从客户端忽略这个头字段,并caching结果。 因为我不能轻易更改客户端代码(需要重新安装很多设备)。
我有两个应用程序:HTML + JS前端和PHP后端。 我想设置Nginx,以便两者都从同一个域中提供。 对后端的请求使用以/api开头的URL。 我的尝试是这样的: server { root /path/to/frontend; index index.html; server_name example.com; location / { try_files $uri $uri/ /index.html; } location /api { alias /path/to/backend; index index.php; try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } } 但是,对于后端的所有请求,我最终得到一个404:主脚本未知。 有没有办法实现我在这里要做的事情? 怎么样?