Articles of nginx

无法获得nginxcaching的工作

我主要是简单的nginxconfiguration。 我无法caching工作 http { … server_tokens off; proxy_hide_header X-Powered-By; fastcgi_hide_header X-Powered-By; client_header_timeout 1024; client_body_timeout 1024; send_timeout 9000; proxy_read_timeout 4000; connection_pool_size 256; client_header_buffer_size 1k; client_max_body_size 10m; large_client_header_buffers 2 4k; request_pool_size 4k; proxy_buffers 8 32k; proxy_buffering off; proxy_buffer_size 32k; server_names_hash_bucket_size 64; output_buffers 3 16k; postpone_output 1460; sendfile off; tcp_nopush on; tcp_nodelay on; keepalive_timeout 30 100; ignore_invalid_headers off; […]

Nginx的.conf和简单的math

你可以在nginx conf中做简单的math运算(加/减/除法/乘法)吗?

nginx忽略我的包含指令?

我目前正在从Apache迁移到nginx。 我有几个域将被托pipe在同一台机器上有一个IP地址。 虽然我configuration了nginx –prefix=/my/path但似乎nginx不包含我的vhostconfiguration文件。 我目前的nginx.conf如下所示: http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; # Don't show server version. server_tokens off; index index.html index.htm index.php; # Default server server { listen 81 default; server_name […]

为什么nginx gzip_http_version默认为HTTP 1.1

nginx的gzip模块中的gzip_http_version设置的默认值是HTTP 1.1。 为什么? 使用gzip和HTTP 1.0有什么问题吗?

nginx gzip启用,但不是gzip

我在nginx 1.2.8上启用了gzip,但由于某种原因,它并没有任何东西。 Nginx的安装信息: nginx version: nginx/1.2.8 built by gcc 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) TLS SNI support enabled configure arguments: –prefix=/usr/local/nginx-1.2.8 –with-http_ssl_module –with-http_realip_module –with-http_gzip_static_module –with-pcre –conf-path=/etc/nginx/nginx.conf –add-module=../headers-more-nginx-module-0.19rc1 configuration: user www-user; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; client_max_body_size 10M; sendfile on; keepalive_timeout 65; more_clear_headers "Server"; gzip on; gzip_types text/plain text/css application/json […]

cachingPHP页面,Varnish,nginx,其他?

我有一个Web应用程序运行在一个低端的盒子(1GB内存),提供静态和dynamic(PHP)页面的混合。 这些PHP页面正在查询不经常更改的MYSQL数据库 – 每周一次? 我正在寻求做一个相当数量的caching,以保持一切又好又快。 我有页面,虽然是PHP,信息很less变化(获取可能每月会更改一次的项目列表?)。 几页可能会列出多达400条logging。 我有Varnish,Nginx,PHP-FPM,APC,MYSQL安装。 我想“我已经正确设置了一切。 页面正在服务,我有点击显示在光油…布里尔! 但是,由于网站的性质,我不确定它是否尽可能优化。 最近的search提出了一些可能有助于我的PHP页面的东西: nginx FastCGIcaching memcached的 MYSQL查询caching 一个例子:一个新的PHP页面,其中列出了不less(200+)logging:2秒刷新后,1.5(ish)秒。 编辑:我是不切实际的,期望这个页面被caching在线的某处,并提供更快后,已被访问? 什么是我最好的select? 以上的一个或全部?

Nginx rewite规则403错误

我在将.htaccess文件转换为nginx时遇到了麻烦。 我有3个.htaccess文件。 第一个.htaccess文件位于文档根目录中,如下所示: Options +FollowSymLinks RewriteEngine On RewriteRule ^img-(.*)\.html img.php?id=$1 [L] RewriteRule ^slide-(.*)\.html slider.php?id=$1 [L] RewriteRule ^page-(.*)\.html page.php?name=$1 [L] RewriteRule ^contact\.html$ contact.php [QSA,L,NC] 第二个.htaccess文件位于一个名为upload的文件夹中: RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?foo\.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ nohotlink.gif [L] <Files ~ "\.(php|sql|php3|php4|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)$"> order allow,deny deny from all </Files> 第三个也是最后的.htaccess文件位于名为“small”的上传文件夹的子目录中: RewriteEngine Off 现在我在/ etc / nginx中创build了一个名为includes的文件夹,并用这些重写规则创build了3个独立的.access文件: 对于位于文档根目录中的第一个.htaccess文件,我在/ etc […]

如何检查nginx的configuration,但没有复制新的configuration文件到nginx目录?

我有部署脚本,副本包括新的nginxconfiguration文件。 我需要在部署新的应用程序版本之前使用nginx -t来检查nginxconfiguration。 是否有可能检查特定文件的nginxconfiguration? /usr/nginx/sbin/nginx -t -c /var/www/application/vhost.conf

使nginx无法访问上游时忽略站点configuration

在我的nginx中有多个站点configuration,当我重新启动机器时,如果其中一个站点的上游无法到达,nginx根本无法启动,而那些健康的站点不会启动,因此如何让nginx忽略那些无效的网站? http { ## # 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; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; […]

getgrnam(“user”)在/etc/nginx/nginx.conf中失败

我试图运行nginx作为当前用户(= ayush)。 但是在设置user指令时出现以下错误: Dec 11 22:26:13 manjaro nginx[17194]: 2015/12/11 22:26:13 [emerg] 17194#0: getgrnam("ayush") failed in /etc/nginx/nginx.conf:1 Dec 11 22:26:13 manjaro systemd[1]: nginx.service: Control process exited, code=exited status=1 我的nginx.conf: user ayush; worker_processes 1; error_log /var/log/nginx/error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #access_log logs/access.log main; sendfile on; keepalive_timeout 65; server { listen […]