我试图找出为什么我刚刚在Nginx中创build的子域没有使用它的configuration文件中指定的根文件夹。 以下是子域zeta的configuration文件。 server { listen 80; root /var/www/zeta; server_name zeto.mydomain.com; error_log /var/log/nginx/subdomains_error.log; error_page 404 /404.html; if ($subdomain = ""){ set $subdomain something; rewrite /.* /not_found; } location / { index index.php index.html index.htm; access_log /var/log/nginx/subdomains_access.log; location / { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/index.php; access_log /var/log/nginx/subdomains_php_access.log; } location /public { } location […]
我正在使用Stunnel,Varnish和nginx与nodejs应用程序,并且在将非https页面( http://manager.domain.com )redirect到它们各自的https页面( https://manager.domain。 com )。 我只是卡在一个redirect循环,因为所有的stream量首先通过清漆。 这个设置的主要原因是使用ssl的套接字。 Stunnel侦听端口443.它终止SSL连接,并将stream量传递给端口80上的Varnish。Varnish侦听端口80,并根据需要拆分81上的Nginx和3000上的Node.js之间的其他stream量.Nginx侦听端口81.它服务静态文件和其他非Node.js页面。 这里是nginx conf文件 upstream nodejs { server 127.0.0.1:3000; server 127.0.0.1:3000; } server { listen 81; server_name www.domain.net; rewrite ^(.*) http://domain.com$1 permanent; } server { listen 81; server_name manager.domain.com; rewrite ^(.*) https://manager.domain.com$1 permanent; } server { listen 81; server_name domain.com manager.domain.com help.domain.com; access_log /srv/www/domain.com/logs/access.log timed; error_log /srv/www/domain.com/logs/error.log info; […]
我必须为每个虚拟主机定义fastcgi_pass。 我如何在全球范围内定义它? server { listen 80; server_name www.domain.tld; location / { root /home/user/www.domain.tld; index index.html index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/user/domain.tld$fastcgi_script_name; include fastcgi_params; } }
我想在Ubintu服务器12.4上安装nodejs和nginx,并设置它们以进行可靠的工作。 你能否提供以下问题的答案: 我应该在哪里安装nodejs? 我应该在哪里findnodejs项目文件以及我需要设置的权限? 我应该如何设置nginx作为nodejs的代理?
我需要根据请求来自哪个服务器来设置根。 这是我想在nginx中完成的。 我拿出了我认为不相干的东西。 server { listen 81; charset utf-8; server_name d1.com d2.com d3.com; expires -1; location / { location ~* \.(jpg|jpeg|rtf|json|png|gif|css|js|swf|flv|ico)$ { expires max; access_log off; log_not_found off; if (server_name = d1.com) { root /folder1 } if (server_name = d2.com) { root /folder2 } if (server_name = d3.com) { root /folder3 } } try_files $uri […]
我需要在一个域的根目录build立一个Django站点,然后在一个子目录下(例如/ blog /)安装一个Wordpress。 如何configurationNGinX来做到这一点? “漂亮”的url也必须适用于WordPress。 对于Django,我正在使用已configuration好的Gunicorn。 从NGinX我会打电话给“proxy_pass”来指导。 PHP通过FPM运行。 考虑到上面的限制,我将如何configurationNGinX? 任何帮助,将不胜感激! 谢谢。 更新:我已经尝试了几件事情,目前我有一部分工作。 我已经删除了任何Djangoconfiguration。 然后我在/ blog /子目录中find了WordPress。 在那里,我有test.php,它只是调用phpinfo(),然后test.html,它显示纯净的HTML。 当调用test.php时,页面加载。 但是,当我打电话test.html,或index.php(Wordpress索引页),它给了我一个404。 我的nGinxconfiguration: server { listen 80; root /path/to/www/root; server_name domain.com; access_log /path/to/logs/access.log; error_log /path/to/logs/error.log; location / { index index.php; } location /blog { alias /path/to/www/blog; try_files $uri =404; index index.php index.html; } location ~ /blog/.+\.php$ { include […]
我在Ubuntu 12.04.1上configuration了unattended-upgradesconfiguration以实现自动安全更新,并且我首先添加了Nginx deb http://nginx.org/packages/ubuntu/ lucid nginx deb-src http://nginx.org/packages/ubuntu/ lucid nginx 到/etc/apt/sources.list文件,就像官方wiki提示的那样,然后通过 sudo apt-get update sudo apt-get install nginx 其中安装了Nginx的所有标准模块。 但是现在我想我可以很好地使用Nginx可选模块中的一个或两个,例如gzip预压缩模块或一些与安全相关的模块。 到目前为止,我看到了两种向Nginx添加可选模块的方法,一种是从源代码编译和安装,另一种是在本文中描述。 那么,我应该select哪种方式,以便自动更新仍然运行并适用于Nginx及其可选模块? 还是应该使用特定于Nginx的命令/脚本创build一个cron作业,而不是使用unattended-upgrades实用程序? 我可以在卷更新和仅安全更新之间进行select,以自动应用于标准模块和可选模块吗? 最后,是否有可能自动更新Nginx的模块(没有任何连接被丢弃),就像文档中提到的那样 sudo kill -USR2 $( cat /run/nginx.pid ) PS其实我不确定如果unattended-upgrades实用程序会自动更新标准模块,自从安装Nginx以来肯定没有足够的时间。
我有一个简单的Nginx的静态网站,我试图实现从mysite.com/index.html到mysite.com的redirect,所以它更适合search引擎。 但是我得到一个redirect循环。 我写了这个规则: location = /index.html { rewrite ^ http://mysite.com permanent; } 做一些testing,我注意到,如果我redirect到404页面,一切都很好: rewrite ^ http://mysite.com/404.html permanent; 这是完整的configuration文件: server { listen 80; server_name www.mysite.com; rewrite ^/(.*) http://mysite.com/$1 permanent; } server { listen 80;# default_server; listen ipaddress:80; server_name mysite.com; access_log /var/www/mysite.com/logs/access.log; error_log /var/www/mysite.com/logs/error.log; root /var/www/mysite.com/htdocs; error_page 404 /404.html; location = /index.html { rewrite ^ http://mysite.com permanent; […]
我想在我的Capistrano部署上创build一个任务,将我的公网IPconfiguration到我的NGINX服务器的地理模块configuration上,而不用重启NGINX,可以吗? 例如,我的/etc/nginx/nginx.conf: geo $geo { default no; include /home/deploy_user/appname/shared/ip_list; } 我将在部署期间提供/ home / deploy_user / appname / shared / ip_list文件。 我需要这个,因为我的公共IP可以改变很多次。 问候,若昂
我正在寻找设置一个nginx反向代理,使一些即将到来的服务器移动和负载均衡的实现更容易在我们的应用程序。 由于我们的服务器都是IIS大小写敏感性不是问题,但现在与nginx它成为我的一个。 无论如何,我只是想重写一遍。 基础设施说明 所有的后端服务器都是IIS 大多数服务都是WCF服务 我正在尝试简化这些URL,以便在我们继续构build时移动服务 由于以下错误,我无法将我的位置设置为不区分大小写: nginx:[emerg]“proxy_pass”不能在正则expression式给出的位置,或指定位置内,或者if语句内,或者在/etc/nginx/sites-enabled/test.conf中的“limit_except” :101 我正在尝试处理重写的conf文件的主要部分如下所示 location /svc_test { 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_pass http://backend/serviceSite/WFCService.svc; } location ~* /test { rewrite ^/(.*)/$ /svc_test/$1 last; } 这是我无法弄清楚的testing位置。 如果我打电话给http://nginxserver/svc_test/help我得到WCF帮助页面正确显示,我可以做所有可用的REST调用。 这是我的一个头脑的正则expression式的问题,但我已经尝试了几个变化,所有我可以得到从Nginx的404或500错误。 这不是火箭科学,所以有人可以指引我正确的方向,所以我可以看起来像一个白痴,只是继续前进?