nginx config for phpbb and laravel

时间:2017-09-14 22:41:55

标签: laravel nginx phpbb

I need an nginx config that will work for both Laravel and Phpbb.

I have used laravel forge to setup my digital ocean server, and it created this nginx config:

# 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/*;

The /public folder is where the front controller index.php of Laravel lives...

Also in the public folder, I have and install of phpbb at - /public/board

I am upgrading the forum, and as such I need to rum the phpbb installer, which resides at:

localhost/board/install,

which then calls:

localhost/board/install/app.php/update

The above url is then giving a 404 error.

I have read elsewhere that this is because Nginx needs to be configured correctly in order to run the installer.

The sample Nginx config for phpbb is listed here

所以我需要以某种方式合并它们,但到目前为止我的尝试都失败了。

我尝试添加:

location /board/ {
    rewrite ^(.*)$ /app.php/$1 last;
}

到现有的laravel nginx文件,但失败了。我知道我需要把它放在nginx配置中的正确位置,但我担心我可能会忽略其他东西,因为我在这里猜测...

有人可以帮忙吗?

0 个答案:

没有答案