在看到这篇文章http://www.ewanleith.com/blog/900/10-million-hits-a-day-with-wordpress-using-a-15-server后,我将服务器从 apache2 更改为 nginx。我不是计算机极客,精明。我按照步骤操作。在那之后,这个网站就完美了,除了一件事:非 www 到 www 的事情。我在网上搜索了如何做到这一点。我尝试了他们说的 modrewrite 东西,但变得更糟了。现在,它被定向到 www,因为我使用 wordpress 并将其设置在常规设置http://www.pageantly.com中。然而,我有静态目录,它是普通的非 www。请查看我在 /etc/nginx/conf.d/ 中的 default.conf 以及上面链接的教程:
server {
server_name pageantly.com www.pageantly.com;
root /var/www/;
listen 8080;
## This should be in your http block and if it is, it's not needed here.
index index.html index.htm index.php;
include conf.d/drop;
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
}
# BEGIN W3TC Page Cache cache
location ~ /wp-content/w3tc/pgcache.*html$ {
add_header Vary "Accept-Encoding, Cookie";
}
[...]
}
# END W3TC Page Cache core
}