Nginx support

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Nginx support

Post by borisrunakov »

Can you please verify if this: https://github.com/phpbb/area51-phpbb3/ ... ample.conf is the recommended way of using phpbb3 with nginx ?
Thank you in advance and forgive me if this has been answered before !
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Nginx support

Post by david63 »

Is that not the same as the one in the download package?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Re: Nginx support

Post by borisrunakov »

Ah sorry ! I didn't know there is one in the download package :(
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Re: Nginx support

Post by borisrunakov »

Trying to use the sample nginx conf file, I have changed the corresponding paths and replaced myforum.com with my forum url, symlinked the file to /etc/nginx/sites-enabled/ I am getting :

Code: Select all

“http” directive is not allowed here in /etc/nginx/sites-enabled/test.conf:14  
Any ideas please?
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: Nginx support

Post by AlfredoRamos »

Use this sample config file, it works for phpBB 3.2.x, 3.3.x and, most probably, versions to come.

Code: Select all

# Sample nginx configuration file for phpBB.
# Tested with:
# - nginx 0.8.35
# - nginx 1.17.7 (mainline)
#
# Filename: /etc/nginx/sites-available/example.com.conf
#
# Replace example.com with your own domain name.

# If you want to use the X-Accel-Redirect feature,
# add the following to your config.php.
#
#  define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
#
# See http://wiki.nginx.org/XSendfile for the details
# on X-Accel-Redirect.

# Sample FastCGI server configuration.
# Filename: /etc/nginx/conf.d/php.conf
#
#  upstream php {
#      server unix:/run/php-fpm/php-fpm.sock;
#  }

# Remove www domain prefix.
server {
	listen 80;
	# IPv6
	listen [::]:80;

	# Remove www
	server_name www.example.com;
	return 301 $scheme://example.com$request_uri;
}

# Board configuration.
server {
	listen 80;
	# IPv6
	listen [::]:80;
	server_name example.com;
	root /path/to/phpbb;

	# phpBB uses index.htm
	index index.php index.html index.htm;

	# Loggers
	error_log /var/log/nginx/example.com.error.log warn;
	access_log /var/log/nginx/example.com.access.log;

	location / {
		try_files $uri $uri/ @rewriteapp;

		# Pass the php scripts to FastCGI server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /app.php$is_args$args;
			fastcgi_pass php;
		}

		# Deny access to internal phpbb files.
		location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
			deny all;
			# deny was ignored before 0.8.40 for connections over IPv6.
			# Use internal directive to prohibit access on older versions.
			internal;
		}
	}

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

	# Correctly pass scripts for installer
	location /install/ {
		try_files $uri $uri/ @rewrite_installapp =404;

		# Pass the php scripts to fastcgi server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /install/app.php$is_args$args =404;
			fastcgi_pass php;
		}
	}

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

	# Deny access to version control system directories.
	location ~ /\.svn|/\.git {
		deny all;
		internal;
	}
}
Source: nginx.sample.conf

The error you are getting is because you're using an outdated sample config file included in a download package.
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:
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Re: Nginx support

Post by borisrunakov »

AbaddonOrmuz wrote: Mon Aug 03, 2020 11:15 pm Use this sample config file, it works for phpBB 3.2.x, 3.3.x and, most probably, versions to come.

Code: Select all

# Sample nginx configuration file for phpBB.
# Tested with:
# - nginx 0.8.35
# - nginx 1.17.7 (mainline)
#
# Filename: /etc/nginx/sites-available/example.com.conf
#
# Replace example.com with your own domain name.

# If you want to use the X-Accel-Redirect feature,
# add the following to your config.php.
#
#  define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
#
# See http://wiki.nginx.org/XSendfile for the details
# on X-Accel-Redirect.

# Sample FastCGI server configuration.
# Filename: /etc/nginx/conf.d/php.conf
#
#  upstream php {
#      server unix:/run/php-fpm/php-fpm.sock;
#  }

# Remove www domain prefix.
server {
	listen 80;
	# IPv6
	listen [::]:80;

	# Remove www
	server_name www.example.com;
	return 301 $scheme://example.com$request_uri;
}

# Board configuration.
server {
	listen 80;
	# IPv6
	listen [::]:80;
	server_name example.com;
	root /path/to/phpbb;

	# phpBB uses index.htm
	index index.php index.html index.htm;

	# Loggers
	error_log /var/log/nginx/example.com.error.log warn;
	access_log /var/log/nginx/example.com.access.log;

	location / {
		try_files $uri $uri/ @rewriteapp;

		# Pass the php scripts to FastCGI server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /app.php$is_args$args;
			fastcgi_pass php;
		}

		# Deny access to internal phpbb files.
		location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
			deny all;
			# deny was ignored before 0.8.40 for connections over IPv6.
			# Use internal directive to prohibit access on older versions.
			internal;
		}
	}

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

	# Correctly pass scripts for installer
	location /install/ {
		try_files $uri $uri/ @rewrite_installapp =404;

		# Pass the php scripts to fastcgi server specified in upstream declaration.
		location ~ \.php(/|$) {
			include fastcgi.conf;
			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			fastcgi_param PATH_INFO $fastcgi_path_info;
			fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
			fastcgi_param DOCUMENT_ROOT $realpath_root;
			try_files $uri $uri/ /install/app.php$is_args$args =404;
			fastcgi_pass php;
		}
	}

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

	# Deny access to version control system directories.
	location ~ /\.svn|/\.git {
		deny all;
		internal;
	}
}
Source: nginx.sample.conf

The error you are getting is because you're using an outdated sample config file included in a download package.
Thank you very much! However I am getting :

Code: Select all

no port in upstream "php" in /etc/nginx/sites-enabled/forum:62
Any ideas please?
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Re: Nginx support

Post by borisrunakov »

Maybe I should look into something like this : https://www.digitalocean.com/community/ ... php7-0-fpm ?
borisrunakov
Registered User
Posts: 18
Joined: Tue May 26, 2020 9:34 pm

Re: Nginx support

Post by borisrunakov »

Following this tutorial: https://www.digitalocean.com/community/ ... untu-14-04 solved my issue ! Thank you all !
User avatar
Le_Spirit
Registered User
Posts: 10
Joined: Thu Sep 03, 2015 5:19 pm

Re: Nginx support

Post by Le_Spirit »

Struggling to get the correct settings for my board, could you borisrunakov please share the settings working for you ?
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26505
Joined: Fri Aug 29, 2008 9:49 am

Re: Nginx support

Post by Mick »

borisrunakov hasn’t visited for a year so I suggest you start your own topic, this one has been marked solved in any case, by supplying as much information as you can including any error messages. You can always link back to this topic if you wish.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
sreni
Registered User
Posts: 6
Joined: Sun Feb 06, 2022 5:09 pm

Re: Nginx support

Post by sreni »

Le_Spirit wrote: Tue Jan 25, 2022 9:13 am Struggling to get the correct settings for my board, could you borisrunakov please share the settings working for you ?
Here is mine setting

Code: Select all

server {
    listen      ip:443 ssl http2;
    server_name v3n0m.xyz www.v3n0m.xyz;
    root        /home/admin/web/v3n0m.xyz/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/v3n0m.xyz.log combined;
    access_log  /var/log/nginx/domains/v3n0m.xyz.bytes bytes;
    error_log   /var/log/nginx/domains/v3n0m.xyz.error.log error;

    ssl_certificate      /home/admin/conf/web/v3n0m.xyz/ssl/v3n0m.xyz.pem;
    ssl_certificate_key  /home/admin/conf/web/v3n0m.xyz/ssl/v3n0m.xyz.key;
    ssl_stapling on;
    ssl_stapling_verify on;

    include /home/admin/conf/web/v3n0m.xyz/nginx.hsts.conf*;
    
    
    
        location / {
	    try_files $uri $uri/ @rewriteapp; 
          # phpbbseo mod rules 		
            include     /home/admin/conf/web/v3n0m.xyz/phpbbseo.conf; 
           
        location ~ \.php(/|$) {
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT $realpath_root;
            try_files $uri $uri/ /app.php$is_args$args;
            fastcgi_pass    unix:/run/php/php7.4-fpm-v3n0m.xyz.sock;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
            include     /home/admin/conf/web/v3n0m.xyz/nginx.fastcgi_cache.conf*;
        }

       # Deny access to internal phpbb files.
	location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
	   deny all;
       # deny was ignored before 0.8.40 for connections over IPv6.
       # Use internal directive to prohibit access on older versions.
	  internal;
          
          }

      }     

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

       # Correctly pass scripts for installer
        location /install/ {
       # phpBB uses index.htm
             try_files $uri $uri/ @rewrite_installapp = 404;

        # Pass the php scripts to fastcgi server specified in upstream declaration.
        location ~ \.php(/|$) {
            # Unmodified fastcgi_params from nginx distribution.
            include /etc/nginx/fastcgi_params;
            # Necessary for php.
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT $realpath_root;
            try_files $uri $uri/ /install/app.php$is_args$args;
            fastcgi_pass unix:/run/php/php7.4-fpm-v3n0m.xyz.sock;
        }
     } 

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

        # Deny access to version control system directories.
        location ~ /\.svn|/\.git {
	    deny all;
	    internal;
     }

        location /error/ {
            alias   /home/admin/web/v3n0m.xyz/document_errors/;
    }

        location ~ /\.(?!well-known\/) { 
            deny all; 
            return 404;
    }

        location /vstats/ {
            alias   /home/admin/web/v3n0m.xyz/stats/;
            include /home/admin/web/v3n0m.xyz/stats/auth.conf*;
    }

      proxy_hide_header Upgrade;

      include     /etc/nginx/conf.d/phpmyadmin.inc*;
      include     /etc/nginx/conf.d/phppgadmin.inc*;
      include     /home/admin/conf/web/v3n0m.xyz/nginx.ssl.conf_*;
  }
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52768
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Nginx support

Post by stevemaury »

Mick wrote: Tue Jan 25, 2022 9:50 am borisrunakov hasn’t visited for a year so I suggest you start your own topic, this one has been marked solved in any case, by supplying as much information as you can including any error messages. You can always link back to this topic if you wish.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
Post Reply

Return to “[3.3.x] Support Forum”