【发布时间】:2019-09-09 03:41:20
【问题描述】:
无法弄清楚为什么 nginx 会继续重定向到 Welcome to nginx 页面。我正在尝试安装和运行一个开源应用程序(问题 2 答案)。只是想先让它在我的虚拟机中本地运行。
我在一个 vagrant vm 机器上。运行 16.04 的 Ubuntu。我在本地机器上编辑了我的 /etc/hosts 文件以匹配我的 vagrant box 中的文件。我尝试了不同的教程以及 SO,但仍然重定向到欢迎页面
这是我的服务器文件
server {
#Nginx should listen on port 80 for requests to yoursite.com
listen 80;
listen [::]:80;
#Create access and error logs in /var/log/nginx
access_log /var/log/nginx/yoursite.access_log main;
error_log /var/log/nginx/yoursite.error_log info;
#Nginx should look in /var/www/q2a for website
root /var/www/q2a.org/q2a/;
#The homepage of your website is a file called index.php
index.php;
server_name local-q2a.org;
#Specifies that Nginx is looking for .php files
location ~ \.php$ {
#If a file isn’t found, 404
try_files $uri =404;
#Include Nginx’s fastcgi configuration
include /etc/nginx/fastcgi.conf;
#Look for the FastCGI Process Manager at this location
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_param HTTP_X_FORWARDED_FOR
$http_x_forwarded_for;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
}
}
我正在尝试让应用至少在本地运行。
【问题讨论】:
-
使用
nginx -t测试您的配置文件。index.php;声明很可疑,您可能打算写index index.php;
标签: php ubuntu nginx nginx-config question2answer