Articles of nginx

nginx重写文件的位置

在我的应用程序中,我试图将http://domain.com/accounts/login和/accounts/register链接到http://domain.com/accounts.php?action=$ ,其中$是这样的: http://domain.com/accounts/$ 我不知道在哪里定义重写和放下什么。 我可以通过SSH访问整个VPS,但是我不确定要编辑哪个文件。 那么文件位于哪里? 我检查了/ opt /文件夹,它看起来是空的。 我可能正在运行lighttpd,所以你能帮我两个例子吗? 否则,你能告诉我如何检查我是否使用lighttpd。

Node.js:Nginx不会提供静态内容

我想通过我的node.js应用程序上的nginx服务器静态内容。 对于看似简单明显的设置,我无法通过nginx路由静态内容。 用这一行: location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ { access_log off; expires max; } nginx不服务任何静态内容(js,css,图像) – 但删除这个我看到,静态内容显示。 在Node方面,我使用express和jade。 nginx.conf: https ://gist.github.com/3331669 默认: https : //gist.github.com/3331674

Nginx的memcachecaching和失效

我们目前使用NGINX作为我们的服务器,我们使用memcache来cachingdb查询以及php中的页面。 我们有一个版本编号系统,在任何更新或插入的情况下,这个版本号都会被提升,结果是每个密钥都附加了这个版本号,所以memcache总是会获取新的数据。 它对我们很有用,因为读写%split是80/20%,所以大部分时间memcache将会返回数据,而不会触及数据库。 现在我们打算把这个caching策略移到服务器级别,NGINX和memcache模块一起使用请求URI和版本号cachingGET请求。 只需要一些反馈,我可以如何实现这一点 我可以获取存储在NGINX的memcache中的这个版本号吗? (这将被用来将其附加到请求uri) 我如何处理login用户? (我可以只为一个login用户设置一个cookie,并检查这个cookie是否存在于nginx中,如果它只是将请求传递给后端而不是memcache)

Linux的PHP Web服务器+ Apache或Nginx的

我接近完成一个网站,需要决定使用什么Web服务器。 该网站使用PHP非常沉重 – 每个页面上都有很多PHP。 我读过Nginx对于静态页面的速度更快,但是与PHP在Apache上的performance相比,它的性能有问题。 有没有人有任何意见,我应该使用哪个Web服务器。 谢谢

PHP的exec()不会运行所有的命令

我在Ubuntu上使用Nginx的PHP-FPM。 我试图从一个Web应用程序启动一个PHP任务。 以下两个示例在从CLI运行文件时正常工作,但不能从Nginx运行。 exec("notify-send 'Starting master at ".date("h:m:s")."'"); echo exec("/home/rohit/Projects/webapp/console/index.php blast 23"); 这两个从CLI和Nginx都能正常工作。 echo exec("whoami"); echo exec("pwd"); 我试图从www数据更改为PHP-FPM用户rohit(我的用户名),但没有运气。 我究竟做错了什么?

nginx – 找不到位置重写

我试图redirect不同的URI请求到不同的EC2容器,我一直使用nginx作为一个catchall反向代理到Apache,但现在我想有一些重写在nginx级别完成。 这是我想要完成的: server { listen 80; server_name _; gzip on; gzip_static on; gzip_buffers 16 8k; gzip_comp_level 9; gzip_http_version 1.0; gzip_min_length 0; gzip_types text/plain text/css application/x-javascript; gzip_vary on; location / { # catch the following URI's including homepage: /contact.html, /terms.html, / proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 240; proxy_connect_timeout 240; proxy_send_timeout 240; […]

铁轨nginx乘客返回http 301在林德VPS

我已经部署了一个rails应用程序来使用capistrano来编写VPS。 现在,当我尝试访问http://mysite.com我得到一个301redirect到https://mysite.com ,失败,因为我没有ssl设置 nginx的conf文件 server { listen 80; server_name mysite.com; root /home/stream_production/current/public; passenger_enabled on; rails_env production; } 访问日志 – [20 / Oct / 2012:14:29:23 -0700]“GET / HTTP / 1.1”301 5“ – ”“Mozilla / 5.0(Windows NT 6.1; WOW64)AppleWebKit / 537.4(KHTML,像Gecko )Chrome / 22.0.1229.94 Safari / 537.4“ 我使用Ubuntu 12.04,rvm 1.15.8,ruby 1.9.3,rails 3.2.8,Phusion Passenger 3.0.17,Passenger的Nginx模块。

Nginx背后的Apache由于DirectorySlashredirect而公开

我有Apache运行在端口8097,和Nginx代理请求: location / { proxy_pass http://127.0.0.1:8097; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffers 32 4k; } Apacheconfiguration(有意义的部分): <Directory /home/some/htdocs> Options FollowSymLinks Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> 那么会发生什么:当我去www.mysite.com/photos和存在一个目录photos Apacheredirect到这个目录与斜线添加。 但由于某种原因,它实际上将我redirect到www.mysite.com:8097/photos/我在浏览器中看到了这个地址,我实际上不应该这样做: HTTP/1.1 301 Moved Permanently Server: nginx/1.2.4 […]

除了其他子域名,nginx wwwredirect

也许还有另一个nginx的redirect问题…找不到答案,所以: 如何将http://domain.comredirect到http://www.domain.com,但是不要在给定包含此服务器定义的cloudfoundry nginxconfiguration的情况下重写任何子域http://*.domain.com: server { listen 80; server_name _; server_name_in_redirect off; } 我试过这个configuration server { server_name domain.com rewrite ^(.*) http://www.domain.com$1 permanent; } server { listen 80; server_name _; server_name_in_redirect off; } 但是获得无限的redirect。

configurationnginx以防止Cloudbees超时

我在我的cloudbees(roo + spring mvc)应用程序中有一个很长的过程,导致超时。 根据前面的问题 ,解决方法是更改​​nginx的configuration(特别是send_timeout指令)。 我的问题是,我不知道如何改变这个给定的事实,我不是自我托pipe的应用程序,但使用CloudBees的。 这是我可以在cloudbees-web.xmlconfiguration文件中指出的东西吗? (我还没能find一个完整的configuration参数列表,我可以包含在这个文件里)