Tag: Nginx

nginx – nginx: bind()到:80失败(98:地址已经在使用)

突然之间,我得到了下面的nginx错误 * Restarting nginx * Stopping nginx nginx …done. * Starting nginx nginx nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already […]

NGinx默认的公共www位置?

我之前和Apache一起工作过,所以我知道默认的公共Web根目录通常是/var/www/ 。 我最近开始使用nginx,但我似乎无法find默认的公共Web根。 我在哪里可以findNginx的默认公共Web根?

我在哪里可以findnginx的错误日志,使用fastcgi和django

我用fastcgi + nginx来使用django。 我想知道在这种情况下,日志(错误)的存储位置

Nginx – 静态文件服务混乱与根和别名

我需要通过我的应用程序服务器在8080 ,我的应用程序和我的静态文件从一个目录,而不必接触应用程序服务器。 我有的nginxconfiguration是这样的… # app server on port 8080 # nginx listens on port 8123 server { listen 8123; access_log off; location /static/ { # root /var/www/app/static/; alias /var/www/app/static/; autoindex off; } location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 现在,使用这个configuration,一切工作正常。 请注意, root指令被注释掉了。 如果我激活root并取消激活alias ,它将停止工作。 但是,当我删除尾随/static/从root开始再次工作。 有人可以解释发生了什么事。 […]

从$ request_bodyloggingPOST数据

我有我的configuration设置来处理一堆GET请求,使渲染的像素能够正常工作,以处理分析和parsing查询string以进行日志logging。 有了额外的第三方数据stream,我需要处理一个POST请求到一个给定的url,它的请求体内有一个预期的可login格式的JSON。 我不想在proxy_pass上使用辅助服务器,只想将整个响应logging到关联的日志文件中,就像GET请求所做的一样。 我正在使用的代码片段如下所示: GET请求(很好用): location ^~ /rl.gif { set $rl_lcid $arg_lcid; if ($http_cookie ~* "lcid=(.*\S)") { set $rl_lcid $cookie_lcid; } empty_gif; log_format my_tracking '{ "guid" : "$rl_lcid", "data" : "$arg__rlcdnsegs" }'; access_log /mnt/logs/nginx/my.access.log my_tracking; rewrite ^(.*)$ http://my/url?id=$cookie_lcid? redirect; } 这是有点什么我想要做的:POST请求(这是行不通的): location /bk { log_format bk_tracking $request_body; access_log /mnt/logs/nginx/bk.access.log bk_tracking; } curl的curl http://myurl/bk -d name=example给了我一个404页未find。 […]

nginx – client_max_body_size没有效果

nginx一直说client intended to send too large body 。 谷歌search和RTM指出我client_max_body_size 。 我把它设置为200m在nginx.conf以及在vhost conf ,重新启动Nginx几次,但我仍然收到错误消息。 我忽略了什么? 后端是php-fpm ( max_post_size和max_upload_file_size地设置)。

Nginx的403禁止所有文件

我在CentOS 5盒子上安装了PHP-FPM的nginx,但是我正努力让它为我的任何文件服务 – 无论是否PHP。 Nginx以www-data:www-data的forms运行,默认的“EPEL欢迎使用nginx”站点(拥有644权限的root用户)加载正常。 nginxconfiguration文件有一个include指令/etc/nginx/sites-enabled/*.conf,我有一个configuration文件example.com.conf ,因此: server { listen 80; Virtual Host Name server_name www.example.com example.com; location / { root /home/demo/sites/example.com/public_html; index index.php index.htm index.html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param SCRIPT_FILENAME /home/demo/sites/example.com/public_html$fastcgi_script_name; include fastcgi_params; } } 尽pipepublic_html被www-data:www-data拥有2777个文件权限,但是该网站无法提供任何内容 – [error] 4167#0: *4 open() "/home/demo/sites/example.com/public_html/index.html" failed (13: Permission […]

调整nginx worker_process以获得每分钟100k点击次数

我们有一台服务器正在提供一个html文件。 现在服务器有2个CPU和2GB的内存。 从blitz.io,我们得到每分钟12k的连接,从那60秒中的200个超时,每秒250并发连接。 worker_processes 2; events { worker_connections 1024; } 如果我增加超时,响应时间开始爬超过一秒钟。 我还能做些什么来挤出更多的汁液呢?

Google bot通过HTML5模式路线在AngularJS网站上爬行

我们有一个使用HTML5路线的AngularJS网站。 我只是做了一些testing“抓取谷歌”运行。 结果有点混乱: 在抓取选项卡上,我看到我们的网站,因为它看起来在视图源,所有的前端绑定{{}},而不是所有的HTML呈现 在渲染选项卡上,我们的网站看起来非常好,没有{{}}variables,看起来像谷歌机器人抓取和渲染的网站,这也许是符合这个http://googlewebmastercentral.blogspot.ae/2014/ 05 /渲染页面与提取作为google.html 。 不过,我们已经准备好让Google无法抓取我们的网站,所以我们已经添加了,所以Google bot会以“?_escaped_fragment_ =”重新访问我们的网页,我们遵循https://developers.google.com / webmasters / ajax-crawling / docs / getting-started (“3.处理没有哈希碎片的页面”)在我们的Nginxconfiguration中,我们有这样的内容: if ($args ~ "_escaped_fragment_=") { serve the static HTML snapshots } ,如果我们自己传递_escaped_fragment_ =,它确实可以正常工作。 但是,Google机器人从未尝试使用此参数来抓取我们的网站,因此它从不抓取快照。 我们错过了什么吗? 我们是否也应该在我们的Nginx conf上添加Google bot的代理检测? 像这样的东西? if ($http_user_agent ~* "googlebot|yahoo|bingbot|baiduspider|yandex|yeti|yodaobot|gigabot|ia_archiver|facebookexternalhit|twitterbot|developers\.google\.com") { server from snapshots } 如果我们能更好地理解这一点,那将是非常好的,非常感谢你! 更新: 我只是读了这个, http://scotch.io/tutorials/javascript/angularjs-seo-with-prerender-io?_escaped_fragment_=tag#caveats 。 所以,在使用手动工具(Google抓取)的时候,我们也应该把自己放在#! 或?_escaped_fragment_ […]

Nginx的403错误:的目录索引是被禁止的

我有3个域名,并试图使用Nginx在一台服务器(数字海洋液滴)上托pipe所有3个站点。 mysite1.name mysite2.name mysite3.name 其中只有一个工作。 另外两个导致403错误(以相同的方式)。 在我的nginx错误日志中,我看到: [error] 13108#0: *1 directory index of "/usr/share/nginx/mysite2.name/live/" is forbidden 。 我的网站启用configuration是: server { server_name www.mysite2.name; return 301 $scheme://mysite2.name$request_uri; } server { server_name mysite2.name; root /usr/share/nginx/mysite2.name/live/; index index.html index.htm index.php; location / { try_files $uri $uri/ /index.html index.php; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; […]