Articles of nginx

使用nginx client_body_in_file_only上传文件

我正在尝试configuration我的nginx,以便我能够将一些file upload到我的服务器上的一个目录。 这是我从某处find的基本configuration: location /upload-modified-reports/ { limit_except POST { deny all; } client_body_temp_path /tmp/nginx; client_body_in_file_only on; client_body_buffer_size 128K; client_max_body_size 50M; proxy_pass_request_headers on; #proxy_set_header content-type "text/html"; proxy_set_header X-FILE $request_body_file; proxy_set_body $request_body_file; #proxy_pass http://localhost:8080; proxy_redirect off; } 经过这个我明白了上面的configuration是做什么的,但是当我使用ajax发送一个请求在/upload-modified-reports我得到的method not allowed 。 我想这是因为在上面的configurationproxy_pass部分。 这是一个提供一个proxy_pass的标准方法,将请求转发给我们,或者我们可以完全省略这部分? 我所需要的是,我必须能够将file upload到临时位置,并且,如果可能的话,文件的名称可用于位于nginx后面的应用程序服务器。

如何检查EC2上的多个tomcat实例是否正常工作

我已经将两个tomcat实例添加到一个EC2容器,并使用nginx负载均衡器 。 我已经根据两个tomcatsconfiguration了nginx。 (一个实例在8080端口工作,另一个在8081端口工作) 有没有什么方法可以分别检查这两个实例是否工作正常? 我想知道的是,检查两个节点是否分别与负载均衡器和负载均衡器一起工作。 感谢您作为AWS初学者的帮助。

Nginx的地图query_string不会工作

当我把这个在我的nginx.conf的http块中: map $query_string $bye_cache { default ""; ~*nocache=1 "1"; } 并尝试与我的主机conf位置块中的variables一直工作“”,即使我打电话的URL?nocache = 1 我的块看起来像: location ~* \.(jpg|jpeg|gif|png|svg|css|js|ico|xml|woff|woff2|eot|ttf)$ { access_log off; log_not_found off; set $expire "1d"; set $cachecontrol "public"; set $maxage "86400"; if ($bye_cache = "1") { set $expire "-1"; set $cachecontrol "no-cache"; set $maxage "0"; } autoindex off; gzip_static on; gzip_min_length 1000; gzip_comp_level 2; expires […]

在Nginx中使用Stream Proxy作为NTLM时,如何replace页面链接中的URL

我正在尝试使用Nginx为IIS服务器设置反向代理。 但是,由服务器引起的使用Windows身份validation(NTLM),因此我在Nginx中使用蒸汽模块,通过此解决scheme引用 现在我可以从反向代理服务器访问URL,我的configuration如下: worker_processes 1; events { worker_connections 1024; } stream{ upstream backend { hash $remote_addr consistent; server 10.0.0.5:80 weight=5; server 10.0.0.5:80 max_fails=3 fail_timeout=30s; } server { listen 58093 ssl; ssl_certificate my.cer; ssl_certificate_key my.key; ssl_session_cache shared:SSL:1024m; ssl_prefer_server_ciphers on; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass backend; } } 现在我遇到一个问题,那就是页面里有一些仍然使用原始IP地址(10.0.0.5)的链接,当我点击它们时,仍然会跳转到原来的服务器地址。 我知道有一个名为sub_filter的指令可以replace这个URL,但似乎只能在“http”块中起作用。 如果有任何类似的指令,我可以在“stream”块中使用? 非常感谢您的帮助。

nginx似乎没有转发资源

我试图代理一个https网站,我希望人们能够像在真实的网站上一样浏览我的代理,我也想修改应得的内容(在将来)。 通过proxy_pass,我可以代理主页面,只要我尝试访问位于真实网站上的资源或发送http post / get data我得到一个404 Not Found错误 /etc/nginx/nginx.conf user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { server_tokens off; ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; […]

php7.0-fpm上游超时没有任何等待

我在nginx日志中收到这样的消息。 而且有这样的错误的请求在浏览器(504响应)中立即终止,不需要任何长时间的操 2017/11/24 09:20:53 [error] 175829#175829: *13282 upstream timed out (110: Connection timed out) while reading response header from upstream 直接打开php-fpm池configuration中的访问日志后,发现请求不是由php-fpm处理的(它们根本不在日志文件中) nginx的: server { listen 80; server_name example.com; access_log /var/www/example.com/access.log; error_log /var/www/example.com/error.log error; client_max_body_size 10m; location / { root /var/www/example.com/public; index index.php; try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { root /var/www/example.com/public; try_files $uri […]

在AWS Ubuntu实例上的Nginx上设置SSL

我目前在运行Linux的AWS实例上有一个NodeJS(Koa.js)/ Angular4 +应用程序,我需要configuration它来使用SSL。 我已经在线学习了几个教程,生成了SSL证书,并试图使这个工作,迄今我没有运气。 让我来解释我到目前为止所做的事情: 我已经生成了SSL证书,它位于实例的/ home / ubuntu目录下的一个名为ssl-bundle.crt的文件中。 我也有密钥坐在同一个目录。 我已经在Nginx上configuration了我的服务器模块,如下所示(/etc/nginx/sites-available/dashboard.conf): server { listen 80; return 301 https://$host$request_uri; } server { listen 443; ssl_certificate /home/ubuntu/ssl-bundle.crt; ssl_certificate_key /home/ubuntu/dashboard.d*****d.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/d*****d.access.log; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:4000; proxy_set_header X-Forwarded-Proto […]

x-Accel-redirect不能使用SSL

在所有情况下,Nginx都可以正常工作,但只有一个。 当域设置为https时,X-Accelredirectfunction不起作用。 它在http模式下工作完美。 我不知道什么Nginx的configuration文件重写和哪些行必须重写。 我有3个Nginxconfiguration文件作为可能的目标:在/ etc / nginx我有nginx.conf; 在/etc/nginx/conf.d/ domain.com.config和XXX.XXX.XXX.20.conf 任何帮助将是apreciate

通过Apache / Nginx代理将特定的Kibana dasboard公开在静态URL后面

我们在Centos 7上安装了Kibana 5.5.2,安装了许多仪表板,所有工作都很好地连接到IP:5601。 一位客户要求我们让自己的仪表板在特定的主机名下可以访问。 我们尝试了很多configuration,通过Apache和Nginx代理,但我们没有成功。 在这里你有更多的细节: 客户想要去http://dasboard.customer.com这样的东西,并看到在embedded式模式(全屏)的仪表板。 url必须保持“静态”(在.com后面没有上下文或值) 我们将Apacheconfiguration为将这个虚拟主机代理给Kibana给出的特定的“快照简短URL” / goto / some-alphanumeric-code context),但是我们得到很多Kibana 错误或404(也许很多资源得到很多,而不是用这种proxyPass重映射) ProxyPass / http://10.10.102.4:5601/goto/be563e821f356144222a28b348e48a2d?embed=true nocanon 有人可以给我们提示或例子吗? 问我是否需要额外的资讯。 非常感谢!

codeigniter nginx php7重写规则

我最近刚刚购买了一个在Codeigniter中开发的新Web应用程序。 对于testing运行,我已经将它安装在Xampp的当前Windows计算机上,但是如果将它放到我的实际环境(即Ubuntu 16 + Nginx + Php7)(我们称之为“活动框” )似乎有相当多的错误。 Web应用程序支持php7,毫无疑问,但我想重写规则有一些问题。 我有几个基于laravel的web应用程序运行在同一个“活箱”,我仍然无法得到这个工作。 我已经在网上尝试了数十件事和build议,但似乎没有任何工作。 唯一的工作是实际的安装程序,然而,一旦我尝试login作为pipe理login页面刷新后,只要我input我的正确的凭据(注意这里:它显示错误,如果证书是错误的),但其他页面,如“忘记密码…”等。 简单地给我一个nginx 404。 为了这个post,我把我所做的所有事情倒回去,然后回到实际上允许我成功通过安装程序的步骤: location / { try_files $uri $uri/ /index.php; ….. location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; } 有没有什么方法可以真正查明和修复? 一些专家的意见,将不胜感激