我正在尝试使用LEMP安装程序在Linux VPS中安装wordpress网站。到目前为止,我已经完成了在WP目录/文件上的wordpress文件的设置以及对nginx用户/组的所有权的设置,但是当我转到该地址以访问WP的安装页面(https://domain.tld/wp-admin/install.php)时,我最终得到了而是下载一个php文件。
这是我对WP站点的虚拟主机配置:
server {
listen 80;
server_name domain.tld;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /directory/to/crt;
ssl_certificate_key /directory/to/key;
server_name domain.tld;
root /var/www/html/domain.tld;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
}
编辑:我在Firefox中尝试过,它的行为与在Chrome中不同。相反,install.php页面最终显示在错误页面中,如下所示:
发生错误。
抱歉,您要查找的页面当前不可用。
请稍后再试。
如果您是此资源的系统管理员,则应检查>错误日志以获取详细信息。
忠实的,nginx。
最佳答案
我现在开始工作了。错误出在虚拟主机的* .conf文件上。我错了php-fpm袜子的目录。因此,这就是php无法在站点上正常工作的原因,而只是下载install.php文件,而域最终以错误结束。
fastcgi_pass Unix:/var/run/php5-fpm.sock;