Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

positonic's avatar

nginx config for phpbb and laravel

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.

So I need to merge these somehow, but so far my attempts have failed.

I tried adding :

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

to the existing laravel nginx file, but that fails. I am aware that I need to put it in the right place in the nginx config, but I fear I'm probably overlooking something else, as I am guessing a bit here...

Can anyone help please?

0 likes
0 replies

Please or to participate in this conversation.