嘿,我想安装一个论坛(xenforo),我已经获得了所有.php文件,我将文件夹放在/ usr / share / nginx / html上,页面在哪里(主页面index.html),但是当我做127.0.0.1/forum/我得到那个错误
403 Forbidden
nginx/1.10.3
所以我想知道如何解决它,配置就是那个
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 {
}
getenforce已禁用
答案 0 :(得分:0)
在nginx上设置Xenforo 2时,您需要阅读documentation here。
它告诉您如何像这样设置nginx配置:
location /xf/ {
try_files $uri $uri/ /xf/index.php?$uri&$args;
index index.php index.html;
}
location /xf/install/data/ {
internal;
}
location /xf/install/templates/ {
internal;
}
location /xf/internal_data/ {
internal;
}
location /xf/library/ { #legacy
internal;
}
location /xf/src/ {
internal;
}
location ~ \.php$ {
try_files $uri /index.php?$uri&$args;
#try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
这应该可以解决您的问题。那就是我在centminmod上使用的,并且效果很好。如果您的论坛位于根目录中,请从每个路径中删除“ / xf”,或者如果您位于其他文件夹中,请进行更改。