【发布时间】:2018-02-24 17:44:31
【问题描述】:
我正在尝试使用 Ubuntu 在 nginx 上设置 Question2Answer 网站 (yoalfaaz.com)。现在,网站的主页确实加载了,但任何其他页面都无法正确加载。大多数情况下,当我点击我网站上的任何帖子时,它会再次打开主页,有时会破坏布局。
这是sites-available file
server {
listen 80 ;
listen [::]:80 ;
root /var/www/yoalfaaz.com/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name yoalfaaz.com www.yoalfaaz.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
现在,以前只打开主页,对于其他每个页面,我都收到 404 Not Found 错误。所以我对try_files 行做了一些更改,之后网站页面没有以正确的方式打开。
我也检查了任何类型的错误,但没有任何错误,如果我尝试nginx -t,那么它也显示成功。请帮帮我,伙计们。
【问题讨论】:
标签: nginx