Articles of nginx

Nginx的proxy_pass与PHP身份validation?

嘿,所以我基本上希望做的是设置nginx作为一个内部IIS服务器的托pipe内容的反向代理。 nginx服务器必须使用PHP / MySQLlogin系统对用户进行身份validation,如果他们没有通过身份validation,则会被要求login。但是,如果他们已经login,则他们的请求将被传递给IIS服务器。 这个设置是否可以使用proxy_pass? 我知道我可以用一个htpasswd文件使用auth_basic,但我可以发送请求到一个PHP身份validation文件,或者我最好使用curl或readfile()在PHP中实现相同的请求? 我只是认为从performance的angular度来看,这可能不是一个好的做法。 任何帮助是极大的赞赏。

Nginx虚拟主机servername,root

我在FreeBSD-9.2-RELEASE-p5上安装了nginx-1.6.2,2 ,这是我的configuration: # tail -2 nginx.conf include _includes/*.conf; } # cat _includes/XXX.conf server { server_name XXX; root /home/user/XXX/; index index.php; include _includes/_location-php.include; } # cat _includes/_location-php.include location ~ \.php$ { include fastcgi_params; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } # tail -1 /var/log/nginx-error.log 2014/11/17 11:45:59 [error] 82950#0: *6 open() "/usr/local/www/nginx/admin.php" failed (2: No such […]

如何在RHEL上configurationnginx来识别外部网站的根证书?

安装程序 :我有一个nginx反向代理,它是ASP.NET应用程序的负载均衡器。 问题是当ASP.NET应用程序尝试访问外部应用程序时,SSL握手失败。 我认为外部服务器和nginx反向代理之间存在SSL / TLS连接。 因此,基本上,外部网站的SSL证书不被nginx反向代理识别。 如何在RHEL上configurationnginx来识别服务器证书? 它是一个nginxconfiguration还是只使用安装在RHEL上的客户端证书?

Drupal 7多站点子文件夹nginxconfiguration

我正在使用perruioconfiguration的Drupal,但我认为这是专为单一的网站。 PHP不能在子文件夹中工作。 我想创build一个结构如下: 主要网站 /var/www/domain.com/master/src/ 子站点 在/ usr /本地/子网站/ _site1 / src目录/ 在/ usr /本地/子网站/ _site2 / src目录/ 在/ usr /本地/子网站/ _site3 / src目录/ 我想要访问的子网站如下: domain.com/site1 domain.com/site2 domain.com/site3 有没有任何nginxconfiguration? 我想添加3个子文件夹到以下configuration。 # -*- mode: nginx; mode: flyspell-prog; ispell-current-dictionary: american -*- ### Configuration for domain.com. ## HTTP server. server { listen 80; # IPv4 server_name localhost; limit_conn […]

基于正则expression式匹配的NGiNX自定义caching参数

我的问题如下: 我如何设置基于正则expression式的自定义variables对useragent? 如何为反向代理请求设置自定义标头? 我如何使用这些值作为caching参数? 细节: 我正在做我的应用程序基于用户代理parsing的初始输出…这基本上打破了请求渲染,所以初始渲染将匹配引导大小的“xs”,“sm”,“md”,“lg” … 我有我的正则expression式制定出来,以便移动设备将得到输出呈现为“xs”和普通的平板电脑将默认为“sm”,其他任何人都得到“md”…客户端绑定后,它将调整为实际的设备显示,这主要是让浏览器将得到他们需要的大小。 我想要做的是: 根据与用户代理的模式匹配设置一些参数,这些参数将通过(反向代理)传递给我的应用程序 X-Initial-Size – “xs”,“sm”,“md”,“lg”(实际上什么都不会解决为“lg” X-Is-Human – 与已知的机器人进行匹配以进行检测 X-Browser-Class – “古代”,“现代”,“ie#”(IE <= 9) 使用X-Initial-Size和X-Browser-Class作为变长参数,以实现更长时间的服务器端输出caching。

Synology Rackstation – 更好的安装方式

我们正在使用Synology Rackstation存储来存储由4x Nginx后端服务的静态内容。 现在我们用nfs4挂载它,如下所示: 192.168.0.20:/volume1/images2 /data/images nfs4 _netdev,rsize=32768,wsize=32768,intr,noatime 0 0 但是现在我们正在寻找获得静态内容的最高性能的方法(大部分是〜500KB的图像)。 有没有更好的方法来做到这一点? 谢谢!

nginx重写特定的.css url到特定的.php url

我假设这对于任何有nginx知识的人来说都是一件容易的事情。 我打电话这样的URL: /site-preview/css/custom-styles.css?org=myorg custom-styles.css文件实际上并不存在。 所以,我想重写URL来实际服务这个: /css/custom-styles.php?org=myorg 我来自Apache世界,我有这个工作在我的.htaccess文件。 在我的nginxconfiguration中,我尝试了如下的东西: location /site-preview { rewrite ^/site-preview/css/custom-styles.css?(.*) /css/custom-styles.php?$1 last; } 和: location /site-preview { rewrite ^css/custom-styles.css?(.*) /css/custom-styles.php?$1 last; } 以及在location块之外进行rewrite 。 提前致谢。

反向SSL代理:在NGINX和Joomla前面的NGINX

我的问题类似于这个 ,除了我有另一个nginx服务器后面的nginx SSL代理服务器: ————————– ——————————– ———- | nginx: https://bla.com | —–> | nginx: http://localhost:8080 | —-> | Joomla | ————————– ——————————– ———- 在nginx中是否有类似SetEnvIfNoCase X-Forwarded-Proto https HTTPS=on的选项? 目前,我有问题,静态内容,如JavaScript和CSS文件不服务。 前端nginx代理上的configuration: server { listen 443; listen [::]:443 ipv6only=on; server_name bla.com; // cut ssl settings location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto […]

Nginx的:如何重写传递给index.php的参数?

我正在为传递给index.php的url参数重写一些Nginx。 老: ?topic=10126.msg36887 新: ?posts/36887/ 我的两个问题: 1)如何重写新的参数结构,因为它使用“参数/值/”而不是传统的“参数=值”结构? 2)我的“如果”的声明是不触发的,我不明白为什么…testingurldomain.com/forum/index.php?topic=10126.msg36887应redirect到/success ,但它是根本不会改写。 这是我目前的Nginxconfiguration: location /forum/ { index index.php index.html index.htm; try_files $uri $uri/ /forum/index.php?$uri&$args; location /forum/index.php { # I know Nginx 'If is Evil', but it's the only way # to trigger rewrites on url parameters if ($arg_topic ~ [0-9]+\.\bmsg([0-9]+) { # testing whether 'if' triggers: rewrite ^ […]

Nginx无法显示正确的网页

我在一个用户文件下创build了一个html文件,我希望Nginx能够提供这个html文件。 但网站总是显示默认的。 我是Nginx的新手,我希望有人能帮助我。 任何帮助将不胜感激,我真的想得到一些帮助。 谢谢