在ubuntu中下载的 WordPress 是运行在 Apache服务器上的,如果想要Nginx反向代理需要 nginx.conf 如下配置:
server {
listen 9001;
autoindex on;
server_name blog.***.com;
root /usr/share/wordpress;
access_log /usr/local/nginx/logs/access.log combined;
index index.php index.htm index.jsp index.html;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://127.0.0.1:80/wordpress/;
add_header Access-Control-Allow-Origin *;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}