Articles of nginx

代理caching区静态是未知的

我正在设置一个反向代理caching。 在nginx.conf中添加了以下内容: location /blog { # Reverse Proxy # Cache the Blog Pages from Heroku proxy_cache STATIC; proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; rewrite ^/blog$ /; rewrite ^/blog/(.*)$ /$1; proxy_pass http://whispering-retreat-1.herokuapp.com; break; } 但是,当试图重新启动nginx我收到以下错误: $ /opt/nginx/sbin/nginx -s stop nginx: [emerg] "proxy_cache" zone "STATIC" is unknown in […]

用nginx和php-fpm连续分段错误(代码11)

我运行的是具有1.2 GHz CPU和2.4 GB RAM的CentOS 6 64位服务器。 服务器运行nginx和php-fpm与APC扩展和mysql。 几个星期前,服务器开始不断地在HTTP请求上抛出500个错误; Google WMT每天报告抓取错误中的每天450个服务器错误。 如果你正在浏览网站,每3-4页左右就会出现一个错误。 这是如何configurationphp-fpm: pm = dynamic pm.max_children = 45 pm.start_servers = 15 pm.min_spare_servers = 5 pm.max_spare_servers = 15 pm.max_requests = 1000 在检查我在php-fpm错误日志中发现的日志之后,发现这些是最常见的两个错误: ERROR: fork() failed: Cannot allocate memory (12) WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, […]

在非标准端口上使用SSL时,无法在Nginx中重写URL

我在非标准端口上使用我的应用程序的testing实例,并希望使用nginx将所有传入的http请求redirect到https 这是我的nginxconfiguration: I tried the above but Cant seem to get it working : please see below …… include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { listen 9000; server_name iossapp1.com; if ($scheme = 'http') { rewrite ^ https://$server_name:9443$request_uri? permanent; } } ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; server { listen 9443 ssl; server_name iossapp1.com; error_page 497 https://$host:9443$request_uri; location / […]

适用于Windows或Linux的Nginx – 推荐用于Redis群集,推荐configuration是什么?

目前我们正在研究Nginx作为反向代理服务器,并且已经对Windows版本做了一些初步的testing。 由于稳定的产品已经可用于Linux,我想知道是否有人在生产中使用了Windows版本,如果有的话,可能会出现任何问题。 我已经阅读了一些关于必须正确configurationcaching的内容,希望能够从有经验的人那里得到更多的信息 – 具体来说,什么是最佳的设置。 这将作为许多Redis服务器的反向代理 – 在一台服务器出现故障时执行故障切换机制(备份configuration)。 在这种情况下,是否需要Http2RedisModule?

我可以将NGINX设置为透明的SSL代理吗?

NGINX可以设置为支持SSL的反向透明代理吗? 我有一个使用HTTPS的第三方应用程序。 出于商业目的,需要logging来自HTTPS连接的一些请求数据。

如何从nginx和uwsgi上的一个Django项目运行多个网站

如何从单个Django代码库运行两个网站或一个站点的子域。 项目中的每个Django应用程序都可以在不同的域上为网站提供动力,但是所有的应用程序仍然可以共享单个pipe理界面的单个数据库。 我使用uWSGI-Nginx-Django进行部署 谢谢。

如何将php代码运行到Nginx下的.html文件中?

我怎么能让nginxparsingphp代码到扩展名为.htm的文件中? 我需要这个,因为我从apache迁移,更改所有的文件扩展名将是一个非常头痛的问题。 谢谢。

Nginx为各个域的HTTPS请求提供相同的内容

我在我的服务器上创build了一个GitLab实例,我们称之为git.domain1.tld 。 当我连接到https://git.domain1.tld它工作正常。 但是,当我连接到https://domain2.tld ,它显示与https://git.domain1.tld相同的内容,实际上,我没有为domain2.tld HTTPS定义的行为。 我不知道该怎么称呼这种行为,所以我在search互联网寻找解决scheme时遇到了麻烦。 /etc/nginx/sites-available/domain2.tld : server { listen 80 default_server; server_name domain2.tld www.domain2.tld; root /srv/domain2.tld/www/; index index.php index.html index.htm; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } } / etc / nginx / sites-available / gitlab : # GITLAB # Maintainer: @yin8086 # […]

RAM与NGINX,PHP-FPM + APC和Varnish问题

我正在运行一个512MB,我有很多内存问题。 我认为是由于我的configuration。 root@s1:~# free -m total used free shared buffers cached Mem: 1024 1022 1 0 0 0 -/+ buffers/cache: 1022 1 Swap: 0 0 0 root@s1:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 23760 1756 ? Ss 15:33 0:00 init root 1086 0.0 0.0 […]

nginx没有logging任何错误,没有启动

在尝试复制一个nginx到另一个,我担心nginx不启动。 nginx -t说configuration语法没问题。 在nginx.conf中,它被告知要logging错误: error_log /var/log/nginx/error.log; error.log存在,它在启动时重新创build,但始终为空。 在/etc/init.d/nginx start或nginx ,shell中没有通知或错误,也没有error.log中的一行。 不pipe怎样, ps -A|grep nginx告诉我没有任何事情可以开始。 在哪里可以find错误信息或如何找出哪里出了问题。 对于nginx似乎没有“详细”模式:-(