我想在Mac上移植我的本地环境来使用nginx 从日志我第一次得到[emerg] 9449#0: bind() to 0.0.0.0:80 failed (13: Permission denied)但运行sudo nginx解决了这个 现在如果我input地址http://njsphp.dev ,它只是下载一个文件? 在conf我已经设置了一个虚拟主机,我已经把名字放在hosts文件中 server{ listen 80; listen njsphp.dev; server_name njsphp.dev; root /Users/redres/Webdev/nodejsphp; index index.phtml index.htm; location / { } } 谢谢
Nginxconfiguration server { listen *:80; server_name live.domain.com; server_tokens off; charset utf-8; error_log /var/log/nginx/live-error.log info; access_log /var/log/nginx/live-access.log; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:1337; proxy_redirect off; } } 当node.js工作的一切都没关系,但是如果node.js没有启动,我尝试加载页面http://live.domain.com/socket.io/socket.io.js,这让我等了30秒(read_timeout )。 我想这样做,如果node.js 不运行,我得到404或502错误,没有30秒等待超时。 换句话说:我需要立即检查客户端的node.js。
我需要设置nginx将“www.test.com”重写为“www.new-test.com/test/test?foo=bar&bar=foo”。 我试过下面的代码: server { listen 80; server_name test.com www.test.com; access_log off; autoindex off; location / { rewrite ^ http://www.new-test.com/dir/test?foo=bar&bar=foo permanent; } } 我的问题是:“如果在重写结束时指定了?,那么Nginx将放弃原始的$ args”。 好吧,但我需要redirect到与查询完整的URL。 我怎样才能正确地做到这一点?
我想知道,并已经做了一些广泛的search,如何服务一个基于domain.LTD扩展名的静态文件。 Nginx.conf: error_page 502 /maintenance.html; location = /maintenance.html { root /srv/books/current/app/views/layouts/; } 我想要的是基于当前请求的域的扩展来提供本地化的维护页面。 这可能以某种方式使用正则expression式或任何nginx指令?
有一个像下面的服务器设置。 我想限制任何人访问http://myapp.com/blog/index.html这将路由到/public/blog/index.html。 这是可能的,或者我应该真的存储公众以外的博客文件夹? (我不想要) server { listen 80; server_name myapp.* root /srv/myapp/current/public; } server { listen 80; server_name blog.myapp.* root /srv/myapp/current/public/blog; }
我正在使用PHP-FPM的Nginx,我想限制访问我的网站上的PHP文件的子目录,以便只允许来自我的IP地址的stream量。 这是我所尝试的,假设我的IP是1.1.1.1: location ^~ /blocktest/ { if ($remote_addr != "1.1.1.1") { return 503; } } 这会阻止公众,但是PHP脚本不再为我执行,而只是提示下载原始文件。 所以,我尝试在块中包含我的PHPconfiguration文件,如下所示: location ^~ /blocktest/ { if ($remote_addr != "1.1.1.1") { return 503; } include /usr/local/nginx/conf/php.conf; } …但是公众可以再次访问PHP文件。 啊。 任何想法,我怎么能得到这个工作? 谢谢! 作为参考,这里是我的php.conf文件: location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_connect_timeout 60; […]
任何人都可以推荐一个很好的工具来parsing和分析Nginx的访问日志,这将基于正则expression式在我的django urls.py文件(或从他们生成的configuration文件)的URL组? 它不需要是实时的。 我主要关心的一个问题是查看“请求时间”,其中的url可能包含slugs或uuids,并可能包含复杂querystrings的各种网页。 例如:www.example.com/event/detail/my_event_uuid/?something=1234&somethingelse=abc 我的核心关注是我能够查看所有事件详细信息页面的汇总统计信息。 作为一个额外的奖励,我希望能够看到“somethingelse”在查询string中的所有事件详细页面。 其他注意事项:如果可能的话,轻量级,开源的,没有数据库表添加到Django的项目。
我在云中有自己的虚拟服务器,运行nginx和APC。 在这个服务器上,我有一个使用W3TC插件的WordPress博客。 我使用APC启用了页面caching和对象caching。 当访问首页,页面和post来自服务器的响应几乎立即。 但是在search时,响应需要1秒钟。 我想知道是否有可能使响应更快。 使用debugging查询WP插件我已经分析了searchSQL查询,它只需要0.002完成。 根据W3TC的大部分对象被caching。 事实上,Debug Queries插件给出了以下关于search结果的报告: Total query time: 0,01482s for 120 queries. Page generated in 0,00000s, 0,00% PHP, 0,00% MySQL 所以看起来好像页面生成得非常快。 但是服务器的响应仍然需要1秒钟才能完成。 即使页面生成速度很快,我怎样才能知道它是什么让响应花费很长时间? 注:我只是谈论从服务器的响应时间,而不是在浏览器中生成页面的时间。 以下是我的网站的示例search结果 。 这是我目前的php-fpmconfiguration: http : //snipt.org/AiHg7 # tail /var/log/php5-fpm.log [05-Oct-2013 20:20:04] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 […]
我改变了文件权限。 现在我无法访问该网站。 nginx + php-fpm 先前, chown -R user1:user1 /var/www/site.com 我在互联网上阅读,然后我改变了文件权限。 groupadd web-content usermod -G web-content user1 usermod -G web-content apache chown -R user1:web-content /var/www/site.com find /var/www/site.com -type f -exec chmod 640 {} \; find /var/www/site.com -type d -exec chmod 750 {} \; 在此之后,网站显示404错误。 从上面的设置我添加到networking内容组的nginx。 还是行不通。 usermod -G web-content nginx 此外,使用此设置,我不能让用户上传照片上传/目录。 但我想让用户上传照片
我有一个别名的nginx设置,并试图用try_files做一个重写规则。 问题在于它预先提供了文档根目录而没有find该文件。 组态: server { listen 80; server_name mysite.com; root /var/www/default; index index.html index.htm index.php; location /coolapp { alias /home/myhome/coolapp/www/; index index.php; try_files $uri $uri/ /home/myhome/coolapp/www/index.php?url=$uri&$args; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; } } } 并在nginx错误日志中: [error] 21903#0: *2 open() "/var/www/default/home/myhome/coolapp/www/index.php" failed (2: No such file or directory) […]