Articles of nginx

build议使用负载均衡还是HA设置?

我有一个应用程序运行在networking服务器(ws1),并连接到应用程序服务器(as1)。 我有相同的应用程序运行在另一个web服务器(ws2)和另一个应用程序服务器(as2)。 但是我只有一个反向代理服务器。 所以我的设置是类似的 所以目前我在这些服务器之间进行负载平衡。 我的Nginxconfiguration如下所示: http { upstream myapp1 { server ws1.example.com; server ws2.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } } } 但是,通过Nginx进行负载均衡还是进行HA设置会更好。 如果我做HA设置应该是Web服务器和应用程序服务器集群?

TLS / SSL – SNI对Nginx上运行的域名数量有限制吗?

SNI(服务器名称指示)是对TLS / SSL协议的扩展,允许networking服务器在同一个IP上提供多个域,所有域都具有不同的SSL服务器证书。 SNI发现适合于他们要求的域/ URL的SSL证书。 在SNI之前,所有侦听相同IP和端口的虚拟主机都必须具有相同的SSL证书。 任何人都知道,我可以在同一个IP上服务的域名数量有限制吗? 用标准的http,没有限制。 我只是为每个域指定一个不同的虚拟主机,并且Web服务器将客户机的“主机:”头匹配到匹配的server_name或server_alias虚拟主机。 SNI的工作原理类似,但匹配SSL证书,一个IP上可能有数百个。 我想知道有没有人知道SNI是否有限制,或者在同一个IP上有数百个证书缓慢执行。

通过systemdpipe理自编的Nginx

我从源代码编译Nginx,现在我想通过systemd来pipe理它,比如systemctl start,stop,restart,reload,enable nginx.service 。 我需要做什么来启用这个?

ngnix的SSLconfiguration工作得很好,而不是https

我正在运行nginx(nginx / 1.10.0)作为我的web服务器后面的AWS ELB与Drupal 7和使用php7.1问题是http://工作正常,但与https:// url相同的网站只服务页面的https组件而不是像https等非https组件 AWS ELB端发生ssl终止 这是我的nginxconfiguration server { listen 80 default_server; listen [::]:80 default_server; listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name site_url; root /var/www/html/smb; index index.php index.html index.htm ; error_page 404 = @smb; location @smb { rewrite ^(.*)$ /index.php?q=$1 last; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass […]

configurationGoogle Domains,EC2和Nginx

尝试通过Google Domainsconfiguration域名指向我的EC2 (Ubuntu服务器)实例时,我遇到了一个很大的问题。 我将nginx设置为反向代理服务于Django应用程序。 我还configuration了一个弹性IP与EC2实例关联。 当我访问弹性IP( 34.XXX.XXX.28 )时,我得到的应用程序就好了。 这告诉我,一切都在EC2实例(nginx,Django应用程序等)内正确configuration。 问题是当我访问我的域名在www.mydomain.com ,我得到这个页面: 欢迎来到nginx! 如果你看到这个页面,nginx web服务器已经成功安装并正常工作。 需要进一步的configuration。 有关在线文档和支持,请参阅nginx.org。 商业支持可在nginx.com上find。 感谢您使用nginx。 我很困惑为什么直接访问弹性IP工作,但通过域名( www.mydomain.com )访问将导致默认的nginx页面。 有人能指点我的方向吗? 这里是一些背景: 这是我的Google Domainsconfiguration 这些是我的弹性IP和EC2安全入站规则configuration 我的nginx被configuration为侦听端口80.这是我的configuration: upstream djangoapp { server unix:/var/www/run/djangoapp.sock; } server { listen 80; server_name 34.XXX.XXX.28; location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass […]

Nginx Vhost显示默认的索引页面,而不是定义的页面

我最近在Debian 8.8服务器上安装了nginx。 我已经注册了一个域名,现在我想创build一个虚拟主机来提供服务。 (将来我可能会为其他域添加更多的虚拟主机。) 问题是,每当我inputhttp://[my domain]我都会得到默认的nginx欢迎页面,而不是我在/var/www/[my domain]/public_html下创build的页面。 贝娄我发布我input的命令来创build一个新的虚拟主机: sudo mkdir -p /var/www/[my domain]/public_html sudo chown -R www-data:www-data /var/www/[my domain]/public_html sudo chmod -R 755 /var/www sudo nano /var/www/[my domain]/public_html/index.html sudo nano /etc/nginx/sites-available/[my domain] sudo ln -s /etc/nginx/sites-available/[my domain] /etc/nginx/sites-enabled/[my domain] sudo rm /etc/nginx/sites-enabled/default sudo service nginx restart 在vhost文件中,我添加了下面的行: server { listen 80; listen [::]:80; server_name [my […]

NGINX + Symfony – 内部指令是什么redirect?

在官方的NGINX文档中,他们具有以下用于生产级Symfony的configuration: # PROD location ~ ^/app\.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; # When you are using symlinks to link the document root to the # current version of your application, you should pass the real # application path instead of the path to the symlink to PHP # FPM. # Otherwise, PHP's OPcache […]

WordPress网站仍然工作,当我closuresMySQL

我通过SSH进入“service mysqld stop”,发现我的网站还在运行。 更好的是,它运行得比以前更快。 “closuresMySQL ……. SUCCESS!” 任何人知道为什么这是可能的?

Nginx将带有参数的PHP请求redirect到其他页面

我也许有一个简单的问题。 我想redirect这个myBB的页面: /misc.php?action=help&hid=10 对于这个: /document.html 我在nginx的vhostconfiguration中试过这个: location /misc.php?action=help&hid=10 { return 301 /document.html; } 但它没有工作…

如果没有定义位置,请阻止Nginx在根目录下提供任何文件

在一个服务器块中,如果我没有定义任何位置块,看起来Nginx正在提供任何文件。 例如,如果请求是“/foo.html”,它将在根目录下find该文件。 只有匹配一个位置才能使nginx服务文件成为可能? 例如,如果我没有定义任何位置块,那么对“/foo.html”的请求将不起作用。