我试图让nginx接受POST和PUT方法来上传文件。 我编译了nginx_upload_module-2.2.0。 我找不到任何如何。 我只是想只使用nginx这个,没有反向代理,没有其他后端,没有PHP。 这是可以实现的吗? 这是我的conf: nginx version: nginx/1.2.3TLS SNI support enabled configure arguments: –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-http_ssl_module –with-http_realip_module –with-http_addition_module –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_mp4_module –with-http_gzip_static_module –with-http_random_index_module –with-http_secure_link_module –with-http_stub_status_module –with-mail –with-mail_ssl_module –with-file-aio –with-ipv6 –with-cc-opt='-O2 -g' –add-module=/usr/src/nginx-1.2.3/nginx_upload_module-2.2.0 server { listen 80; server_name example.com; location / { […]
出于某种原因,nginx在处理长时间运行的请求(5分钟)之后会在一段时间(2分钟)之后停止任何新的请求。 user www-data www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 1024; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 200; client_max_body_size 12M; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 9; gzip_buffers 16 8k; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; include /usr/local/nginx/sites/*.conf; […]
首先,我必须说,我不是服务器pipe理专家,我的网站是由托pipepipe理员(我无法联系了)设置。 几天前,我更新了Nginx的最新版本(pipe理员告诉我这是安全的)。 但在此之后,我的网站只提供html内容,没有CSS,图像,JS。 如果我尝试打开一些图像,我会收到“Wellcome to Nginx”的消息(如果我尝试打开static.mysitedomain.com,则会显示同样的消息)。 更多细节:网站有静态的。 子域,但是静态文件与设置静态文件之前的目录是在同一个目录中。 我是谷歌search一些解决scheme,我试图改变/ etc / nginx /中的东西,但没有运气。 我觉得这是一些小configuration的问题,有什么想法? 编辑: 这里是/etc/nginx/nginx.conf文件的内容: user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } 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 […]
我得到错误 [anadi@bangda ~]# tail -f /var/log/nginx/error.log [ pid=19741 thr=23597654217140 file=utils.rb:176 time=2012-09-17 12:52:43.307 ]: *** Exception LoadError in PhusionPassenger::Rack::ApplicationSpawner (no such file to load — puppet/application/master) (process 19741, thread #<Thread:0x2aec83982368>): from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from config.ru:13 from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' from config.ru:1:in `new' from config.ru:1 当我启动nginx与乘客模块configuration的服务器时,puppet masterconfiguration为通过机架运行。 这里是config.ru [anadi@bangda ~]# cat /etc/puppet/rack/config.ru […]
我创build了一个WordPress页面,用于WordPress的健康状况监测,链接为http://domain.tld/health_status 。 它经常被访问,所以我不希望这些请求出现在我的访问日志中。 所有WordPress页面的基本“重写规则”是: location / { try_files $uri $uri/ /index.php?q=$args; } 现在,在同一层面上,我尝试了 location /health_status { access_log off; #try_files $uri $uri/ /index.php?q=$args; } 从nginx 位置文档 : 文字string匹配查询的开始部分 – 将使用最具体的匹配 /health_status比/更具体,所以当我请求http://domain.tld/health_status时,这个块会采取行动。 在try_files行注释(如上),请求不会显示在访问日志,万岁,但显然我只是得到一个404错误,因为nginx不redirect到WordPress的这个请求。 在try_files行处于活动状态时,会发生内部redirect到WordPress的index.php ,并在浏览器中显示/health_status WordPress页面。 但是,在内部redirect之后, location /health_status块不再location /health_status ,并且请求在访问日志中结束。 如何干净地解决这个问题? 现在是否必须添加另一个与实际的/index.php?q=healthstatuswhatever匹配的块,而/index.php?q=healthstatuswhatever内部redirect之后发生/index.php?q=healthstatuswhatever请求? 谢谢!
什么是configuration服务静态消息(文本或通过文件)的所有用户代理是IE7及以下。 我不希望IE7,6,5,4等访问我的网站。
我正在我的networking应用程序中提出一个跨域请求。 我在Nginx上设置了CORS头文件。 一切工作正常,除非当服务返回像404,400,500等错误,而不是接收错误代码,该服务失败,说错误的Origin *********** is not allowed by Access-Control-Allow-Origin 。 任何想法,为什么这可能会发生? 这是nginx设置的样子; location /api { add_header Access-Control-Allow-Origin *; }
我的要求: 加权的RR负载均衡 不需要粘性会话支持 不需要SSL 不需要HTTP 1.1来后台 所以有效地,我只需要非常简单的HTTP负载balacing! 我的老板要求尝试HA代理,但我想知道,如果HA代理对我来说是过度杀手 ,我想知道什么是使用HA代理的好处,相比现有的nginx'HttpUpstreamModule 例如(现有的nginxconfiguration) upstream backend { server backend1.example.com weight=5; server backend2.example.com:8080; server unix:/tmp/backend3; } 由于我以前不使用HAProxy ,因此我想听取您的意见。
我遇到了大多数人对Nginx的疑问:502错误的网关错误。 它们是间歇性的,但每次会话通常会发生一次以上,这意味着我的用户几乎每次使用应用程序时都会遇到这种情况。 我已经尝试调整fastcgi_buffers和fastcgi_buffer_size (在两个方向)无济于事。 我用configuration文件尝试了其他各种东西,但似乎没有任何工作。 这里是我的configuration(注意,我已经剥去了我尝试过的大部分东西,因为它们不起作用,我不想用一堆不相关的指令使文件膨胀): server { root /usr/share/nginx/www/; index index.php; # Make site accessible from http://localhost/ server_name localhost; # Pass PHP scripts to PHP-FPM location ~ \.php { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; } # Lock the site location / { auth_basic "Administrator Login"; auth_basic_user_file /usr/share/nginx/.htpasswd; } # Hide the password file location ~ […]
我试图让Kibana在特定的web目录下运行在nginx后面。 或者换一种说法,我试图让nginx反向代理http://example.com/kibana到http://localhost:5601/ ,这是Kibana sinatra应用程序运行的地方。 我已经用一个初始化脚本启动了Kibana,如果我从服务器上curl localhost url,我会得到预期的响应。 然而,导航到http://example.com/kibana/给我的信息, Sinatra doesn't know this ditty. 并build议/kibana/应该做些什么。 据推测,这是一个路由问题。 我的nginxconfiguration是这样的: server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default ipv6only=on; ## listen for ipv6 root /var/www; index index.html index.htm; # Make site accessible from http://localhost/ server_name _; location / { # […]