【发布时间】:2017-09-14 22:41:54
【问题描述】:
我需要一个适用于 Laravel 和 Phpbb 的 nginx 配置。
我使用 laravel forge 设置了我的数字海洋服务器,它创建了这个 nginx 配置:
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/djembefola.org/before/*;
server {
listen 80;
listen [::]:80;
server_name djembefola.org;
root /home/forge/djembefola.org/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:$
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/djembefola.org/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/djembefola.org-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/djembefola.org/after/*;
/public 文件夹是 Laravel 的前端控制器 index.php 所在的文件夹...
同样在公共文件夹中,我有并安装了 phpbb - /公共/董事会
我正在升级论坛,因此我需要安装 phpbb 安装程序,它位于:
本地主机/板/安装,
然后调用:
localhost/board/install/app.php/update
上面的 url 然后给出 404 错误。
我在其他地方读到这是因为 Nginx 需要正确配置才能运行安装程序。
示例 Nginx 配置 for phpbb is listed here.
所以我需要以某种方式合并这些,但到目前为止我的尝试都失败了。
我尝试添加:
location /board/ {
rewrite ^(.*)$ /app.php/$1 last;
}
到现有的 laravel nginx 文件,但是失败了。我知道我需要将它放在 nginx 配置中的正确位置,但我担心我可能忽略了其他东西,因为我在这里猜测了一下......
有人可以帮忙吗?
【问题讨论】: