Code: Select all
“http” directive is not allowed here in /etc/nginx/sites-enabled/test.conf:14
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;
}
}
Thank you very much! However I am getting :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.
Source: nginx.sample.confCode: 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; } }
The error you are getting is because you're using an outdated sample config file included in a download package.
Code: Select all
no port in upstream "php" in /etc/nginx/sites-enabled/forum:62
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_*;
}