Articles of nginx

Nginx反向代理variables和parsing器

我试图设置两端通配符的反向代理,例如。 test.local等到目前为止,我有这个,它正在工作。 server { listen 80; server_name ~^(?<project>.+)\.example\.com$; location / { resolver dns.local; proxy_pass http://$project.local/; } } 但是,没有其他文件得到服务了,例如。 当我请求test.local/style.css我只是再次获得相同的索引。 谢谢!

在Ubuntu 14.04上不能更改PHP 5.5.9上的memory_limit

我使用fpm在Nginx上运行PHP。 报告的memory_limit是128M,我不能改变它为我的生活。 PHPINFO: 服务器API:FPM / FastCGI configuration文件:/etc/php5/fpm/php.ini 内存限制:128M /etc/php5/fpm/php.ini中的memory_limit是256M 如果我运行grep -Ri "memory_limit" /etc它返回: /etc/php5/fpm/pool.d/www.conf.dpkg-dist:;php_admin_value[memory_limit] = 32M │Max: 921.53 kBit/s Max: 11.70 MBit/s /etc/php5/fpm/pool.d/www.conf:;php_admin_value[memory_limit] = 32M │Ttl: 233.43 kByte Ttl: 2.14 MByte /etc/php5/fpm/php.ini:memory_limit = 256M │ /etc/php5/cli/php.ini:memory_limit = -1 我已经停止了nginx和php-fpm,完成了sudo killall php-fpm并重新启动了nginx和php-fpm。 Memory_limit仍然是128M。 请发送帮助。

Nginx:反向代理和httpredirect到https

我目前使用反向代理将my.domain.com映射到端口5000,但也希望将httpstream量redirect到https。 我不想添加SSL证书信息,因为这些都是由Cloudflare处理的。 这是我的工作反向代理: server { listen 80; server_name my.domain.com; proxy_set_header X-Real-IP $remote_addr; location / { proxy_pass http://localhost:3000; } } 这是我的破解( ERR_TOO_MANY_REDIRECTS )尝试将httpsredirect添加到反向代理。 server { listen 80; server_name my.domain.com; return 302 https://my.domain.com$request_uri; } server { listen 443; server_name my.domain.com; proxy_set_header X-Real-IP $remote_addr; location / { proxy_pass http://localhost:3000; } }

Nginx基本authentication的具体位置

我有一个Rails应用程序,并希望在特定位置的基本Nginx的基本authentication,现在我这样做 location / { passenger_enabled on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-FORWARDED_PROTO https; proxy_redirect off; } location /somelocation { auth_basic "Restricted"; #For Basic Auth auth_basic_user_file /usr/local/etc/nginx/.htpasswd; #For Basic Auth passenger_enabled on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-FORWARDED_PROTO https; proxy_redirect off; } 有没有更好的方法来做到这一点?

鱿鱼选项equivilents在Nginx

我正试图从鱿鱼caching到nginx,我有一些问题复制一些选项。 我有这些选项之一,我的squid模式ignore-reload ignore-no-store override-expire override-lastmod ignore-must-revalidate ,我似乎无法得到它在nginx上工作。 我现在的选项是proxy_ignore_headers Expires Cache-Control X-Accel-Expires; 但它并不是将东西保存到我的caching中。

将NGINX转换成Apache重写规则

目前我在我的本地(Apache)做了一个项目设置,在NGINX里。 我在将规则从NGINX转换为.htaccess规则时遇到了麻烦。 有人能帮我把下面的规则转换成.htaccess规则。 location /test/ { set $store_code test; index index.html index.php; try_files $uri $uri/ @handler_test; expires 30d; } 提前感谢。

Apache和Nginx代理连接后面的Websockets未升级

我有个问题。 Apache监听一个白色的ip,并将代理请求/城市仪表板上的所有请求/ ssd代理到另一个带有websocket的服务器。 在Apacheconfiguration中: ProxyPass /ssd/ http://10.127.32.24 ProxyPassReverse /ssd/ http://10.127.32.24 nginxconfiguration:在nginx.conf: map $http_upgrade $connection_upgrade { default upgrade; '' close; } include /etc/nginx/conf.d/*.conf; 在default.conf location /city-dashboard/stream { proxy_pass http://10.127.32.24:5000/stream; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } 请求标题: GET ws://xxxx/ssd/city-dashboard/stream HTTP/1.1 Host: xxxx Connection: Upgrade Pragma: no-cache Cache-Control: no-cache Upgrade: websocket Origin: […]

Piwik + uWSGI设置

我有一个使用nginx设置uWSGI + piwik的问题。 我的configuration遵循这个博客条目 。 我的uwsgi ini文件看起来像这样 [uwsgi] plugins = php chown-socket = www-data:www-data uid = piwik gid = piwik processes = 1 和我的nginxconfiguration server { listen 80; root /var/www/piwik; server_name my.domain.com; index piwik.php; # For administrative access location = /index.php { include uwsgi_params; uwsgi_modifier1 14; uwsgi_pass unix:/var/run/uwsgi/app/piwik/socket; allow 127.0.0.1; # only via ssh tunnel […]

recv还没有准备好(11:资源暂时不可用))(nginx / 1.1.19,supervisorctl,gunicorn)

我有Ubuntu 12.04.5 LTS,django(supervisorctl,gunicorn)的网站。 它工作1年没有问题,但今天我的zabbix服务器发送有关警报(每3-7分钟)关于超时(1-2秒)的消息。 我为nginx运行debugging模式: 2015/08/26 06:24:09 [debug] 24236#0: *214786 http upstream temp fd: -1 2015/08/26 06:24:09 [debug] 24236#0: *214786 http output filter "/management/verify/[email protected]&app_version=4.1&warehouse=131&only_hash=0&pin_number=" 2015/08/26 06:24:09 [debug] 24236#0: *214786 http copy filter: "/management/verify/[email protected]&app_version=4.1&warehouse=131&only_hash=0&pin_number=" 2015/08/26 06:24:09 [debug] 24236#0: *214786 image filter 2015/08/26 06:24:09 [debug] 24236#0: *214786 xslt filter body 2015/08/26 06:24:09 [debug] 24236#0: *214786 http postpone […]

如何replacenginx中头部的主机variables

我正在尝试replacenginxconfiguration中头部的主机variables,以使some.random.sub.example.net变成net-some.random.sub.example.com 。 我已经尝试了以下内容: if ($host ~* "^([^.]+(\.[^.]+)*)\.example.net$"){ set $sub $1; set $host1 "http://net-$sub.example.com"; break; } 然后在位置指令中,我有: location / { proxy_set_header HOST $host1; some conf } 它并没有工作,但! 编辑 完整configuration: server {#http listen 80 default_server; server_name *.example.com; large_client_header_buffers 4 16k; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; if ($host ~* "^([^.]+(\.[^.]+)*)\.example.net$"){ set $sub $1; set $host1 http://cn-$sub.example.com; break; } location […]