Tag: Nginx

  • Using Nginx to Negate Brute Force Attacks on WordPress Sites

    Thanks to the Prometheus – Grafana combo I set up earlier for my Kubernetes cluster I noticed that there was a steep increase of requests to this blog started a few days ago. I checked my Google Analytics dashboard, sadly my blog didn’t become any popular at all. So it must be some sort of […]

  • The Upgrade of Kubernetes Ingress Nginx

    The ingress-nginx container image I’ve been using was v0.25, and that’s more than 1 year old. The recent release is v0.44 but it’s a big leap from 25 to 44 and I’ve found some major differences between the 2 versions. Version 0.25 implemented API version of networking.k8s.io/v1beta1 while version 0.44 has networking.k8s.io/v1. Here are samples […]

  • Nginx + fastCGI + php5-fpm (Ubuntu 10.04)

    参考1: http://wiki.mediatemple.net/w/(ve):Install_PHP-FPM_on_Ubuntu_10.04 参考2: http://wiki.nginx.org/HttpCoreModule#try_files 年前的大事基本都办了, 我又有时间折腾了.  🙂 一直听说用 nginx + fastCGI + php5-fpm 方法跑 PHP 是相当快的. 于是我来试试. 自己的经济舱级别的 VPS 只支持 Ubuntu Server 10.04, php5-fpm 还不在软件源当中. 好在 PPA 源中已经有了. 前提: 如果还不能用 PPA, 先要: $sudo apt-get install python-software-properties 然后添加 php5-fpm 的 PPA: $sudo add-apt-repository ppa:brianmercer/php 假设只缺少 php5-fpm, 其它 nginx, php5, mysql 什么的都有了, 那就… $sudo apt-get install php5-fpm 然后用缺省设置启动 php5-fpm: […]

  • 笔记: Nginx的转发

    就像我启用了新的.info域名这样, 我会希望依旧在用旧的.cn域名访问的朋友在访问旧域名时浏览器会跳转到新域名. 另外如果你注册了很多域名指向同一个网站, 并且希望跳转到主域名, 那么Nginx的配置可以这样写: server { listen 80; server_name old-domain1 old-domain2 old-domain3; rewrite ^(.*)$ http://new-domain permanent; } UPDATE1: 操作符~表示大小写匹配, 而~*表示忽略大小写. !表示取反. 例如 ~ abc 匹配 abc, 而~* abc 匹配Abc ABC等. 括号里面的是参数, 例如 rewrite ^(/download/.*)/media/(.*)\..*$ $1/mp3/$2.mp3 last; 🙂

  • 给Centos安装Nginx

    Centos的缺省软件源里竟然没有Nginx,真让我感到意外了。还好,参考一下,办法还是现成的。 Red Hat Enterprise Linux / CentOS Linux Enable EPEL (Extra Packages for Enterprise Linux) Repository 还是做个笔记吧: # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm 之后就可以yum install nginx啦。 🙂 UPDATE. 现在已经是release-5-4了, 不过不是什么问题吧. UPDATE2. 查看Centos版本: # cat /etc/*release* 查看Centos是32bit还是64bit版本: # uname -a … 2.6.18-028stab070.14 #1 SMP Thu Nov 18 16:04:02 MSK 2010 i686 i686 i386 GNU/Linux << 32bit UPDATE3. 将CentOS标配PHP5.1.x升级到5.2.x, […]

  • 用Nginx给Joomla!提速

    Joomla!是个不错的基于PHP的CMS,在LAMP环境下安装运行都非常方便,不过性能并非最优。一个提速的方法是用Nginx服务静态内容。 Nginx的配置片段: upstream apache1{ server 127.0.0.1:8001; } server{ listen 80; server_name mysite.com.cn www.mysite.com.cn; location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { root   /home/raymond/public_html/www.mysite.com.cn; expires 14d; gzip on; gzip_comp_level 3; gzip_types text/plain text/javascript text/html text/css image/png application/json application/x-javascript text/xml application/xml+rss; gzip_vary on; gzip_buffers 16 8k; } location / { proxy_pass    http://apache1; proxy_set_header   Host             $http_host; proxy_set_header   X-Real-IP        $remote_addr; proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for; […]