我有一个在 Apache 上运行的 Wordpress 网站,它负载严重超载,所以我想尝试用 nginx/fastcgi 替换它,看看是否有帮助。
我编译了 spawn-fcgi,并配置了 nginx 服务器,该服务器将在端口 81 上运行,以进行测试。当我尝试访问该站点时,它显示“正在等待站点”,并且从未加载(访问日志未显示任何内容)
我像这样启动了 spawn-cgi:
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 53217 -P /var/run/fastcgi-php.pid -- /usr/bin/php-cgi
这是我的 nginx 配置:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen xxx.xxx.xxx.xxx:81;
server_name domain.com www.domain.com;
access_log /home/domain.com/nginx.access.log;
root /home/domain/public_html/; # absolute path to WordPress installation
try_files $uri $uri/ /index.php;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:53217;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/domain/public_html$fastcgi_script_name;
}
}
}
events {
worker_connections 1024;
}
最后,这是我的 fastcgi_params 文件:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
我的配置中是否有任何内容会阻止我提供基本的 WP 网站?我在专用机器上的 CentOS 上运行它。
答案1
从技术上讲这不是一个答案 - 但是如何在服务器和/或客户端上运行网络跟踪(tcpdump / wireshark)并看看它正在尝试做什么?