我正在写这个,因为我整晚都试图修复它。 我们最近已经迁移到一个新的服务器。 在迁移之前,我们一直在nginx + cgi(脚本)上运行我们的站点。 迁移后,我们决定尝试apache + mod_php。 这是相当可怕的,我想迁移回nginx,但这次我想用php-fpm(正如人们所说的那样很酷) 所以我确实遵循了一些指南,我想我做的一切正确。 以及我有我的旧的configuration文件的“服务器”部分,我审查和放置到新的configuration。 所以当我input我们的url时,我最终得到了一个空的网站。 (空白我的意思是空白页,没有字母,错误或任何东西。)在访问日志中有一些奇怪的错误,如: 123.242.148.54 – – [22 / Mar / 2012:06:08:11 +0200]“ – ”400 0“ – ”“ – 我的猜测是,PHP-FPM不工作,但不知道如何确认。 也许有些人可以提供一些帮助? 将不胜感激。 我的nginxconfiguration: user nginx; worker_processes 12; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 4096; } http { include /etc/nginx/mime.types; […]
我使用nginx的gzip模块来压缩文件。 当gzip被启用时,nginx会自动发送包含HTTP头的gzip的内容结尾,对不对? 不添加任何PHP头header()或HTML meta http-equiv ,这完美的工作。 但是,我已经看到在线教程,无论是通过PHP或HTML元,以帮助浏览器处理gzip的数据添加gzip头。 真的需要吗? 由于我不确定是否需要进行某些传导(我没有进行testing),所以我问了这个问题以进一步澄清这个问题。
我有我的nginx conf文件,以便当有移动设备访问我的网站时,URL被重写为m.mysite.com我做了它,通过添加以下 set $mobile_rewrite do_not_perform; if ($http_user_agent ~* "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino") { set $mobile_rewrite perform; } if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[aw])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-)") { set $mobile_rewrite perform; } if ($mobile_rewrite = perform) { rewrite ^ http://m.mywebsite.com redirect; break; } 我从http://detectmobilebrowsers.com/它工作。但是我的图像/ js […]
我的设置: 一个EC2 m1.large实例(4ECU,2个核心,7.5GM RAM) 轨道 Ubuntu 11.04 Natty nginx(v1.05)和Passenger(v3.011) 在Amazon RDS实例上运行MySQL 5.1.57 我希望我的站点能够以大爆发获得大量的stream量,并且我想最大限度地提高服务器可以处理的机会。 在过去,我被“太多打开的文件”错误等东西烧毁了。 不幸的是,我是一个完全sysadmin noob,所以我不知道处理大量stream量的基本configuration选项。 任何意见将是有益的!
我正在考虑从Apache转移到Nginx。 然而,有一个问题,我不知道如何处理最好的:在我的服务器上,我有一些第三方软件,例如phpbb,phpmyadmin等,这些应用程序使用.htaccess文件,这不是由nginx。 当然,我可以决定把所有的htaccess规则和文件都改成与他们的nginx相同,但是这样做也意味着当我更新这些应用程序时,我需要手动检查和更新这些规则。 有没有其他解决scheme来解决这个问题?
我正在从mod_php迁移到nginx。 我得到了一切工作,除了这个重写..我只是不熟悉的nginxconfiguration知道正确的方法来做到这一点。 通过在nginx网站上查看示例,我想到了这一点。 server { server_name test01.www.myhost.com; root /home/vhosts/my_home/blah; access_log /var/log/nginx/blah.access.log; error_log /var/log/nginx/blah.error.log; index index.php; location / { try_files $uri $uri/ @rewrites; } location @rewrites { rewrite ^ /index.php last; rewrite ^/ht/userGreeting.php /js/iFrame/index.php last; rewrite ^/ht/(.*)$ /$1 last; rewrite ^/userGreeting.php$ /js/iFrame/index.php last; rewrite ^/a$ /adminLogin.php last; rewrite ^/boom\/(.*)$ /boom/index.php?q=$1 last; rewrite ^favicon.ico$ favico_ry.ico last; } […]
我正在努力 / -> /foo/index.html /(about|people|contact) -> /foo/(about|people|contact).html /blah.(jpg|css|js) -> /foo/blah.(jpg|css|js) 但也 /index.html -> 404 /(about|people|contact).html -> 404 * -> 404 到目前为止我有: # Serve our home page. location / { root /foo/; } location = / { alias /foo/; } location ~ /(about|people|contact) { default_type text/html; alias /foo/$1.html; } location ~ /(.+\.(jpg|css|js)) { root /foo/; } […]
我试图在运行CentOS的VPS上安装带有PHP和MySQL的Nginx服务器。 我按照这个教程来安装所有的软件。 他服务器正在运行,虚拟主机正在工作,但是当我尝试在PHP文件中连接到MySQL时,服务器返回502 Bad Gateway。 我是Linus的新手,所以我不知道在哪里find所有的日志等。 我在虚拟主机日志中发现了这个错误,但我不知道这是什么意思。 2012/04/15 23:07:33 [error] 22360#0:* 3连接失败(111:连接被拒绝)连接上游时,客户端:212.45.63.107,服务器:@host,请求:“GET / test.php HTTP / 1.1“,上游:”fastcgi://127.0.0.1:9000“,主机:”@host“ (@host是我的服务器)
我想使用memcache模块的nginx先检查我的memcache服务器,然后如果找不到密钥然后回退到我的上游服务器。 我看到很多示例代理多个上游服务器(例如循环),但我可以从这种方式回退memcache未命中?
可能重复: nginx + django提供静态文件 我遵循本指南在Ubuntu 11.10上部署Django + Nginx。 Django运行良好,但不提供任何静态文件。 这是从我的settings.py节选: STATIC_ROOT = '' STATIC_URL = '/static/' ADMIN_MEDIA_PREFIX = DOMAIN_URL + '/static/admin/' STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, 'static'), ) 并从nginx.conf server { listen 80; server_name localhost; # site_media – folder in uri for static files location /static/ { autoindex on; alias /project/app/static; } location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|p$ access_log […]