Phpbb in subfolder with nginx

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
venones
Registered User
Posts: 2
Joined: Fri Apr 12, 2019 12:41 pm

Phpbb in subfolder with nginx

Post by venones »

Support Request Template
What version of phpBB are you using? phpBB 3.2.5
What is your board's URL? https://hardlevel.com.br/forum
Who do you host your board with? vps
How did you install your board? I used the download package from phpBB.com
What is the most recent action performed on your board? Fresh Install
Is registration required to reproduce this issue? No
Do you have any MODs installed? No
Do you have any extensions installed? No
What styles do you currently have installed? none
What language(s) is your board currently using? default
Which database type/version are you using? MariaDB
What is your level of experience? Comfortable with PHP and phpBB
What actions did you take (updating your board; installing a MOD, style or extension; etc.) prior to this problem becoming noticeable? I'm trying to install in a subfolder /forum with nginx aside with my wordpress main site
Please describe your problem. Hi...

I'm trying to install phppb in a /forum subfolder where my wordpress site is installed with nginx

I searched a lot with configurations to do that, but no one worked for me, can anyone help me?

The problem is with the installation, when I click in install the url goes to /install/app.php/install but it is redirected to my main site home
Generated by SRT Generator
Last edited by venones on Fri Apr 12, 2019 4:52 pm, edited 1 time in total.
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: Phpbb in subfolder with nginx

Post by AlfredoRamos »

Try the following, it's based on my configuration file:

Code: Select all

server{
        server_name localhost hardlevel.com.br www.hardlevel.com.br;
        listen 80;
        return 301 https://www.hardlevel.com.br$request_uri;
}
server {
        ## Your website name goes here.
        server_name localhost hardlevel.com.br www.hardlevel.com.br;
        listen 443 ssl;
        #ssl_certificate /var/www/ssl/ssl_bundle.crt;
        #ssl_certificate_key /var/www/ssl/hardlevel.key;
        ssl_certificate /var/www/ssl/new/ssl_bundle_uol.crt;
        ssl_certificate_key /var/www/ssl/new/hardlevel.com.br.key;
        #return 301 https://$host$request_uri;
        ## Your only path reference.
        root /var/www/wordpress;
        #root /var/www/test;
        ## This should be in your http block and if it is, it's not needed here.
        index index.php;
        client_max_body_size 100M;
        #include /etc/nginx/templates/misc.tmpl;
        #include /etc/nginx/templates/ssl.tmpl;
        #include /etc/nginx/templates/iredadmin.tmpl;
        #include /etc/nginx/templates/roundcube.tmpl;
        #include /etc/nginx/templates/sogo.tmpl;
        #include /etc/nginx/templates/netdata.tmpl;
        #include /etc/nginx/templates/php-catchall.tmpl;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location / {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                include fastcgi.conf;
                fastcgi_intercept_errors on;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_connect_timeout 300s;
                fastcgi_read_timeout 300s;
                fastcgi_send_timeout 300s;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
        
        location ~* ^.+\.(zip|rar|7z){
                client_max_body_size 100M;
        }

	# phpBB
	location /forum/ {
		try_files $uri $uri/ @rewriteapp;

		location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
			deny all;
		}

		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_param SCRIPT_FILENAME $request_filename;
			fastcgi_param HTTP_PROXY '';
			try_files $uri $uri/ /forum/app.php$is_args$args $document_root$fastcgi_script_name =404;
			fastcgi_pass unix:/run/php/php7.2-fpm.sock;
		}
	}

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

	location /forum/install/ {
		try_files $uri $uri/ @rewrite_installapp;

		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_param SCRIPT_FILENAME $request_filename;
			fastcgi_param HTTP_PROXY '';
			try_files $uri $uri/ /forum/install/app.php$is_args$args $document_root$fastcgi_script_name =404;
			fastcgi_pass unix:/run/php/php7.2-fpm.sock;
		}
	}

	location @rewrite_installapp {
		rewrite ^(.*)$ /forum/install/app.php/$1 last;
	}

}
Do not forget to update the symlink (between sites-available and sites-enabled), and restart Nginx to pick the changes.
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
venones
Registered User
Posts: 2
Joined: Fri Apr 12, 2019 12:41 pm

Re: Phpbb in subfolder with nginx

Post by venones »

nice! it worked!

thank you very much!
Post Reply

Return to “[3.2.x] Support Forum”