我最近将我的rails应用程序从使用HTTP请求迁移到HTTPS。 我的应用程序URL如下所示: https : //testmate.persistent.co.in 我已经在nginx.conf文件中模拟了所有必需的configuration 我的nginx.conf文件如下所示: # start the http module where we config http access. http { … server { listen 443; ssl on; ssl_certificate certificate.pem; ssl_certificate_key server.key; ssl_protocols SSLv3; proxy_set_header X-FORWARDED-PROTO https; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_max_temp_file_size 0; proxy_set_header X-Forwarded-Ssl on; # doc root root /var/www/TestMate/current/public/; passenger_enabled on; […]
是否有可能在nginx.conf文件中限制传入的POST请求只有几页? 假设我只想在signup.php和login.php上允许发布请求,但是不能在所有其他可能的页面上发布。 我为什么要问的原因是我的服务器经常被随机页面上的POST请求淹没,导致不必要的负载。 我尝试在PHP中阻止它,但在这种情况下,nginx仍然需要处理和接受完整的POST数据。 这是我试图阻止。
我在/ wp目录下有一个wordpress网站,用nginx web服务器。我想限制/ wp / wp-admin文件到我的私有IP地址,并向无通气的客户端返回一个错误。 问题是wp-admin文件夹可以很容易地被限制,但文件仍然可以访问! server { root /usr/share/nginx/html; index index.html index.htm index.php; listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location /main { index index.php; try_files $uri $uri/ /wp/index.php?q=$uri; } error_page 500 502 503 504 404 403 400 /error.html; location = /error.html { root /usr/share/nginx/html; } location ~ \.php$ { fastcgi_pass […]
我想问一下关于Nginx请求的重试。 我有一个运行在后端的Nginx,然后将请求发送到HaProxy然后在Web服务器上传递它并处理请求。 我正在重新加载我的Haproxyconfigurationdynamic提供弹性。 问题是当我重新加载Haproxy时请求被丢弃。 所以我想有一个解决scheme,我可以从Nginx重试。 我查看了http模块中的proxy_connect_timeout,proxy_next_upstream和服务器模块中的max_fails和fail_timeout。 我最初只有1个服务器在上游连接,所以我只是这个了两次现在和更less的请求被丢弃(只有当)有同样的服务器上游两次,如果我有同样的服务器3-4次下降增加)。 所以,首先我想现在,当一个请求无法build立从Nginx到Haproxy的连接,所以当重新加载时,似乎连接被认为是错误和直接的请求被丢弃。 那么我怎么能指定失败后的时间,我想重试从Nginx到上游的请求,或者Nginx把它作为失败请求处理的时间。 (我已经尝试越来越proxy_connect_timeout – 没有帮助,mail_retires,fail_timeout,并把两个相同的上游服务器(迄今为止最好的结果) Nginxconfiguration文件 上游gae_sleep { server 128.111.55.219:10000; } 服务器{ listen 8080; server_name 128.111.55.219; root /var/apps/sleep/app; # Uncomment these lines to enable logging, and comment out the following two #access_log /var/log/nginx/sleep.access.log upstream; error_log /var/log/nginx/sleep.error.log; access_log off; #error_log /dev/null crit; rewrite_log off; error_page 404 = /404.html; set […]
我正在为一个非常有限的设备创build一个Facebook客户端 – 它的网页浏览器(ANT Galio)不能正确处理HTTP302的图像来源。 我的UC看起来像这样 – 在Web应用程序标记configuration文件图像放置方式: <img src="http://reverseproxyfqdn/graph.facebook.com/profileId/picture/" /> 当代理请求graph.facebook.com/profileId/picture/时,它将HTTP 302redirect到不同的地址,例如fbcdn-profile-a.akamaihd.net/someUrl 。 此响应反向代理Web浏览器,位置标题已更改为reverseproxyfqdn / fbcdn-profile-a.akamaihd.net / someUrl 。 我testing过的所有网页浏览器都能正确处理,但不是ANT Galio。 我需要直接返回从fbcdn-profile-a.akamaihd.net/someUrl获得的图像,作为对reverseeproxyfqdn / graph.facebook.com / profileId / picture /的响应 – 因此不要将整个HTTP 302redirect故事暴露给networking浏览器。 有谁知道如何在Nginx或Apache 2.2中做到这一点? 我想避免为此创build一个特殊的PHP / Perl / Java应用程序,并通过HTTP服务器configuration实现它。
我在Linode上有Linode 768mb RAM服务器。 而我有WordPress的博客。 在我的服务器上安装了ubuntu,nginx作为前端,apache2作为后端。 我有APC和memcache模块。 有时站点崩溃。 但服务器的CPU使用率低于临界水平(最高只有60-70)。 但是,在网站崩溃,我可以看到硬盘I / O使用的关键级别。 我读过,这可能是有关MySQL的不正确的设置。 我的nginx.conf: worker_processes 2; events { worker_connections 1024; # multi_accept on; } http { sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 12; tcp_nodelay on; gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; 我的nginx proxy.conf: proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; […]
我正试图从默认的Zend框架路线摆脱index.php。 我认为应该在服务器级而不是在应用程序上进行纠正。 (纠正我,如果我错了,但我认为这样做在服务器端更有效)。 我运行Nginx 0.7.1和php-fpm 5.3.3 这是我的nginxconfiguration server { listen *:80; server_name domain; root /path/to/http; index index.php; client_max_body_size 30m; location / { try_files $uri $uri/ /index.php?$args; } location /min { try_files $uri $uri/ /min/index.php?q=; } location /blog { try_files $uri $uri/ /blog/index.php; } location /apc { try_files $uri $uri/ /apc.php$args; } location ~ \.php { […]
我有点困惑。 我有nginx运行在80以外的端口。 # part of nginx.conf server { listen 7000; include /etc/nginx/my_app.conf; } 这是因为我的HAProxy在同一台服务器上运行在80上。 # Approximate haproxy.cfg listen foo 0.0.0.0:80 option forwardfor server web01 web01:7000 maxconn 25000 check 如何让nginx提供从www.example.com到example.com的redirect? 我尝试了以下,但nginx抱怨,它不能听80(这是有道理的,因为haproxy在那里听)。 server { server_name www.example.com; rewrite ^ http://example.com$request_uri? permanent; }
很长一段时间,我总是在docker运行nginx来做负载均衡。 然而,我有一个新的项目,我将使用HAProxy进行负载平衡,并想知道是否应该让HAProxy直接发送连接到Jetty,或者如果我应该让每个Jetty实例在nginx或其他Web服务器的后面。 具体来说,我想知道是否有任何安全方面的优势/缺点。 如果Jetty受到nginx / apache的“保护”,或者我可以在HAProxy的瘦代理之后将其暴露给互联网吗?
我有一个运行在Nginx(v1.0.14)上的网站作为反向代理,代理请求到Apache(v2.2.19)。 所以Nginx在80端口上运行,Apache在8080上运行。 整体网站工作正常,但我不能阻止访问与.htaccess文件的某些目录。 例如,我有“我的保护目录”在“www.site.com”里面,我有以下代码的htaccess: <Files *> order deny,allow deny from all allow from 1.2.3.4 <— my ip address here </Files> 当我尝试访问此网页与我的IP(1.2.3.4)我得到404错误,这不是我所期望的: http://www.site.com/my-protected-directory 但是,当这个页面直接由Apache提供时,一切都按预期工作。 我可以看到这个页面,其他人都不能。 http://www.site.com:8080/my-protected-directory 更新。 Nginx的configuration(7.1.3.7是站点IP): user apache; worker_processes 4; error_log logs/error.log; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status […]