将wordpress从Apache迁移到nginx

Apache太耗内存了,1G内存大部分都被它吃掉了。换成nginx试试。
不一样的地方,Apache的rewrite规则存储在.htaccess文件中,内容如下:

BEGIN WordPress


RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

END WordPress

换用nginx后,规则更简单了:
1. 直接写入配置文件
2. 只需要一行足矣:
location / {
try_files $uri $uri/ /index.php?$args;
}


nginx内存需求显然比Apache小得多

Leave a Reply

Your email address will not be published. Required fields are marked *