我是一名正在学习nginx的学生,所以请耐心等待。 我只是按照以下指南设置了LEMP堆栈并安装了WordPress: https://www.linode.com/docs/websites/cms/how-to-install-and-configure-wordpress https://www.linode.com/docs/websites/lemp/lemp-server-on-centos-7-with-fastcgi
然而,当我访问我的索引所在的域时,我只需要一个弹出窗口来下载我的index.php。对于指南说,我的配置中的所有内容都是正确的,我尝试进行一些更改无济于事。这是我的配置:
tburg.io.conf:
server {
listen 80;
server_name www.tburg.io tburg.io;
access_log /var/www/tburg.io/logs/access.log;
error_log /var/www/tburg.io/logs/error.log;
location / {
root /var/www/tburg.io/public_html/;
index index.php;
}
}
nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
从我所读过的内容来看,似乎nginx并没有使用fastcgi以它应该的方式解析PHP?但是,此问题的先前迭代似乎都不符合我配置nginx的方式,但我不清楚我做错了什么。谢谢你的帮助!
答案 0 :(得分:0)
一位朋友帮我修好了。我将在我遇到此问题时在我试图设置的博客上发布有关正确设置的指南,并在我完成时将其发布在此处。