现在我的Apach + Nginx VPS有6个站点。 它使用Nginxpipe理插件。 所有这些网站都是WordPress并使用标准安装。 我想知道是否有任何简单的方法来更新所有的虚拟主机nginxconfiguration文件,而不需要编辑每个虚拟主机nginxconfiguration文件(对于常见的变化)。 例如,如果我需要将W3total重写configuration添加到所有这些站点,请立即更新vhostconfiguration文件?
免责声明:我对负载平衡是完全陌生的,对于nginx的使用经验极less。 我将在几个月内推出一个网站,我想确保它保持和响应。 我相信负载平衡是解决这个问题的方法。 不过,我想我可以一箭双雕。 我的目标受众将分散在北美和英国,所以我想要做的就是购买两到三台服务器,将它们分散到不同地域,然后进行负载平衡。 我不想做简单的基于循环的平衡; 我认为将用户引导到最接近的服务器以获得更快的响应时间会更有益, 除非它已closures或负载很重。 我看到有一个叫做ip_hash指令的东西,但是这听起来像只能确保用户被发送到同一个服务器,但不一定是最近的服务器。 有没有办法做我想要的?
我在Ubuntu 12.04的apache2(port 80)上有一个WordPress的博客设置,我也有一个监听端口8080的nginx设置,服务于同一个博客。 我的问题是,每当我尝试打开端口8080上的博客,nginx将请求redirect到Apache不应该发生。 我正在发布/ etc / nginx / sites-enabled / wordpress的内容 server { listen 8080; root /var/www; index index.php index.html index.htm; server_name foobartech.strangled.net:8080; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = […]
我的根结构看起来像这样 / root / / root / projectA / … / root / projectB / … / root / projectC / … 在我的nginx文件中为每个子目录configuration一个额外的位置块之前, 这些位置“块”看起来像这样: server { listen 80; listen [::]:80; root /usr/share/root/projectA/public/; index index.php index.html index.cgi; server_name www.test.de; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param […]
只是为了学习和testing,我已经安装了这三个不同的Web服务器,我也安装了MySQL和PHP5 。 我将每个DocumentRoot都更改为/var/www/apache , /var/www/nginx和/var/www/lighttpd并正常工作。 当然,我也分配了不同的端口。 我可以访问他们三个的服务器主页 。 到目前为止,有什么具体的设置我应该做的。 我应该instually任何包使它们正常使用PHP和MySQL?
我有安装Nginx的Ubuntu。 我没有部署任何网站,只是GET默认的Nginx的静态页面。 这里是Nginx的设置: ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; gzip_comp_level 4; # gzip_buffers 16 8k; # gzip_http_version 1.1; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 我正在使用http://www.gidnetwork.com/tools/gzip-test.php (我的网站testinghttp://demas.me )检查压缩,它说,响应没有压缩。 Google Developers工具说: 为什么压缩不起作用? 谢谢 更新: 完整的Nginxconfiguration: http : //pastebin.com/D7xjzwAf
我正在运行nginx作为apache的反向代理(与django应用程序的mod_wsgi)。 nginx也提供静态文件。 如果我在nginx上启用spdy,我是否也需要在apache上启用spdy来获得spdy的最大利益?
我试图configuration我的nGinx服务器(在Debian Wheezy框中)来服务我的小型PHP应用程序。 我有路由问题。 我需要什么: / – 不允许使用PHP,只是.html文件 / api – 所有内容都转到/api/index.php,包括/ api / method1,/ api / method2等 就这样。 我现在有什么: server { listen 3000; root /home/my_user/php/my_app; index index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { try_files /index.html =404; } location /api { try_files /index.php =404; } location ~ \.php$ { fastcgi_split_path_info […]
我有一堆“redirect规则”,我希望Nginx为我做这个看起来像这样的: /news/?p=12312 —> /news/some/new/url.html /news/?p=12fsd312 —> /news/some/new/url.html 我怎样才能让Ngnix将任何访问/news/?p=12312人redirect到/news/some/new/url.html ? 我努力了 rewrite ^/news/?p=123$ /news/some/new/url.html last; 但似乎并不奏效。
我试图理顺我的Nginx服务器configuration,但我有一个相当愚蠢的问题,我无法解决。 所以,这里是一个问题: rewrite之前还是之后的try_filesparsing? 有不同的问题,我必须在所有 rewrite指令之后放置try_files ,还是Nginxconfigurationparsing器足够聪明以在所有相关的rewrite指令之后评估try_files ? 与configuration合理化的链接是这个问题的答案将改变configuration的组织,即如果try_filesconfiguration文件的顺序和rewrite改变了configuration行为,这将迫使我驱散我的包括,其中一些包含try_files和其他的包含rewrite ,因为我也直接在nginx.conf rewrite 。