我试图redirectwp-content/uploads/(.*)$到images/$1但这个位置似乎没有redirect – 为什么? 使用try_files会更高效吗? location ^/wp-content/uploads/.*$ { rewrite ^/wp-content/uploads/([a-zA-Z\-.]+)$ /images/$1 302; # try_files /images/$1 =404; }
我们有一个WordPress的安装,需要redirect丢失的密码链接到另一个不同的url,我们试图设置redirect规则,但这是行不通的。 任何人都可以请帮助我们。 location / { proxy_pass http://localhost; } location wp-login.php?action=lostpassword rewrite ^(.*) http://recover.geo.com $1 permanent; } 但是loginurl(wp-login.php?action = login)也会redirect到recover.geo.com 我们只需要redirecturl wp-login.php?action = lostpassword到其他所有的url,包括wp-login.php?action = login需要proxypass 任何人都可以请帮助我们正确的configuration。 谢谢
看下面的nginxconfiguration文件。 基于虚拟名称的托pipe(example.com),将example.com和www.example com的请求传递给端口9000上的mono fastcgi进程(127.0.0.1:9000) 我已经添加了文件谷歌网站validation,但问题是,asp.net fastcgi应用程序是一个MVC应用程序,所以它不会find名为“google79af7e588a34905e0.html”的控制器。 我试图覆盖虚拟主机configuration文件中的位置,所以它不会将请求的google79af7e588a34905e0.html转发到fastcgi应用程序,但它不起作用。 我已经重新启动nginx,但它没有区别… 我究竟做错了什么 ? 我已经尝试删除“位置= /”的等号,但这是行不通的,我已经尝试在主要位置之前移动位置覆盖,但这也没有什么差别。 我也改变了主机名称,只是为了看看我是否在正确的configuration文件,而我,当我更改域名,我开始得到404。 ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # http://wiki.nginx.org/Pitfalls # http://wiki.nginx.org/QuickStart # http://wiki.nginx.org/Configuration # # Generally, you will want […]
我有一个在我的networking服务器上运行的nginx服务器。 我想达到以下目的: example.com + www.example.com – > / my / web / dir / www pma.example.com – > / my / web / dir / pma 第一点是没有问题的一切工作正常。 对于第二点,我编辑了/ etc / nginx / sites-enabled / default,并复制了现有的服务器块,为pma.example.com创build一个新的服务器块。 server { listen 80; root /usr/share/nginx/www; index index.php index.html index.htm; server_name example.com www.example.com; location / { try_files $uri $uri/ /index.html; […]
(见下面的编辑) 我有nginx转发请求到Apache 2.4,我得到127.0.0.1作为SERVER_ADDR的值。 正确的IP仅在HTTP_X_SERVER_ADDRESS上可用。 我已经安装了rpaf模块,但它只修复了REMOTE_ADDR值(以前也是127.0.0.1,现在是正确的远程IP)。 有没有办法在SERVER_ADDR上获得正确的服务器IP? 我在nginx.conf中有以下configuration: proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Server-Address $server_addr; proxy_set_header Host $host; 编辑 :我只是意识到,我可以使用proxy_pass [my-server-ip]而不是proxy_pass 127.0.0.1 ,有没有什么缺点呢?
我有一个Nginx服务器,作为一个不支持SSLauthentication的本地主机上运行的服务的SSL代理。 我想使用Nginx的limit_req_zone函数来保护Basic_Auth免受暴力攻击。 有一个类似的问题 ,使用Fail2ban的答案,但我想尽可能使用limit_req_zone。 我有它的工作 – 这是使用这两行代码完成的: http { limit_req_zone $binary_remote_addr zone=one:10m rate=30r/m; # only one login in 2 seconds allowed … location / { limit_req zone=one burst=5 nodelay; # only five connections allowed for the whole / root … proxy_pass http://127.0.0.1:2222/myapp/www/; # redirections to my unauthenticated service } } 问题是,当用户通过身份validation时,它也会阻止请求的数量 ,导致事实上, http://127.0.0.1:2222/myapp/www/ : http://127.0.0.1:2222/myapp/www/ […]
我的nginxconfiguration有问题。 我在同一台服务器上有几个虚拟主机。 但是,我试图添加另一个虚拟主机,这是一个SSL网站。 网站返回的网站是不正确的。 如果我从听443转到听80,正确的网站被恢复。 我无法弄清楚为什么会发生这种情况。 任何帮助将不胜感激,谢谢。 以下是有关虚拟主机的configuration。 虚拟主机,configuration server { listen 443 ssl default_server; server_name *.website.com; root /var/www/vhost/www.website.com/public_html/httpdocs/; index index.php; ssl_certificate /etc/nginx/ssl/www.website.com/website.com.crt; ssl_certificate_key /etc/nginx/ssl/www.website.com/website.com.key; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param […]
我把Nginxconfiguration成简单的粘性LB. configuration的一个关键部分是匹配cookie值到服务器地址。 这工作正常: map $cookie_sessionServer $http_sticky_backend { default 0; Server_A 192.168.73.210:1337; Server_B 192.168.73.210:1338; } 现在,我必须添加点cookie值(为什么是另一个故事)。 但是当我改变configuration,它停止工作。 map $cookie_sessionServer $http_sticky_backend { default 0; .Server_A 192.168.73.210:1337; .Server_B 192.168.73.210:1338; } 没有错误,在debugging日志中没有任何用处,这个映射只是“返回”了默认值(0),粘性逻辑被跳过了。 我也试过\.Server_A 192.168.73.210:1337; 和".Server_A" 192.168.73.210:1337; 和~^\.Server_A$ 192.168.73.210:1337; 和~\.Server_A$ 192.168.73.210:1337; 但这一切都没有为我工作=(
我试图用nginx在我的网站上设置一个静态页面。 该文件夹有一个index.html文件以及一些静态文件。 目录结构看起来像这样 olx –static –fonts –index.html 这是我想如何服务index.html页面。 location /olx { root /mypath/olx; default_type "text/html"; try_files $uri $uri.html $uri/index.html index.html; } 这给了我一个404错误。 任何帮助?
我有一个运行在我的VPS上的WordPress站点,这个站点是相当高规格的(3520MB RAM,4个内核)。 服务器运行Nginx和php5-fpm。 虽然该网站在前端有响应,但后端往往会很慢,一些pipe理页面需要几秒钟才能加载。 该网站运行WooCommerce,但我有WP总caching运行以及APC对象caching。 我的问题是真的关于php5-php的configuration,因为我想我可能没有设置最佳利用服务器的资源。 这是我在php5池中的www.conf : pm.max_children = 10 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers – min_spare_servers) / 2 pm.start_servers = 2 ; The desired minimum number of idle server processes. ; Note: Used […]