Page 1 of 1

Шаблон для phpBB

Posted: Thu Nov 22, 2018 9:10 pm
by pr0g
Привет! Есть ли в природе шаблон Nginx для phpBB?
Пробовал сделать сам, но в итоге не получилось :(

Re: Шаблон для phpBB

Posted: Thu Nov 22, 2018 10:33 pm
by grayfolk
pr0g wrote:
Thu Nov 22, 2018 9:10 pm
Привет! Есть ли в природе шаблон Nginx для phpBB?
Пробовал сделать сам, но в итоге не получилось :(
Вот можно взять как образец, к примеру: https://github.com/phpbb/area51-phpbb3/ ... ample.conf

Re: Шаблон для phpBB

Posted: Fri Nov 23, 2018 2:41 am
by pr0g
grayfolk wrote:
Thu Nov 22, 2018 10:33 pm
Вот можно взять как образец, к примеру: https://github.com/phpbb/area51-phpbb3/ ... ample.conf
Так я его и брал как образец, но секцию install так и не смог заставить работать.

Re: Шаблон для phpBB

Posted: Fri Nov 23, 2018 9:35 am
by grayfolk
Сделал так:

Code: Select all

        location @rewriteapp {
            rewrite ^(.*)$ /app.php/$1 last;
	}
    
    # Correctly pass scripts for installer
        location /install/ {
            # phpBB uses index.htm
            try_files $uri $uri/ @rewrite_installapp;

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include 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    127.0.0.1:9014; // - должно быть то же самое, что и в секции location / дефолтного шаблона
            }
	}
	
	location @rewrite_installapp {
            rewrite ^(.*)$ /install/app.php/$1 last;
	}

Re: Шаблон для phpBB

Posted: Fri Nov 23, 2018 3:00 pm
by pr0g
grayfolk wrote:
Fri Nov 23, 2018 9:35 am
Сделал так:

Code: Select all

        location @rewriteapp {
            rewrite ^(.*)$ /app.php/$1 last;
	}
    
    # Correctly pass scripts for installer
        location /install/ {
            # phpBB uses index.htm
            try_files $uri $uri/ @rewrite_installapp;

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include 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    127.0.0.1:9014; // - должно быть то же самое, что и в секции location / дефолтного шаблона
            }
	}
	
	location @rewrite_installapp {
            rewrite ^(.*)$ /install/app.php/$1 last;
	}
Спасибо за конфиг, помогло. Инсталляция прошла, но теперь если зайти на сайт по адресу http://site.ru (без файла index.php) выдает сообщение:
Image

С файлом index.php все ок:
Image

Можете поделиться вашим полным шаблоном?

Мой шаблон:

Code: Select all

server {
    listen      %ip%:%web_port%;
    server_name %domain_idn% %alias_idn%;
    root        %docroot%;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    auth_basic "Restricted";
    auth_basic_user_file /usr/local/vesta/.htpasswd;

        location / {
            # phpBB uses index.htm
            index index.php index.html index.htm;
            try_files $uri $uri/ @rewriteapp;
        }

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

        # Deny access to internal phpbb files.
        location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|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;
            return 404;
        }

        # Pass the php scripts to fastcgi server specified in upstream declaration.
        location ~ \.php(/|$) {
            # Unmodified fastcgi_params from nginx distribution.
            include 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/ /app.php$is_args$args;
            fastcgi_index   index.php;
            fastcgi_pass %backend_lsnr%; # - должно быть то же самое, что и в секции location / дефолтного шаблона
          }


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

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include 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 %backend_lsnr%; # - должно быть то же самое, что и в секции location / дефолтного шаблона
            }
        }

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


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

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    location /vstats/ {
        alias   %home%/%user%/web/%domain%/stats/;
#        include %home%/%user%/conf/web/%domain%.auth
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}

Re: Шаблон для phpBB

Posted: Fri Nov 23, 2018 6:49 pm
by pr0g
Проблема решилась. У корневой директории отсутствовали права чтения для анонимов.

Re: Шаблон для phpBB

Posted: Thu Mar 04, 2021 3:52 pm
by trom
та же проблема не запускается установка форума phpBB
при нажатии на вкладку install показывает ошибку 404

использую такой конфиг для ngnix
это то что vesta сама сделала плюс секция location от grayfolk из этой темы

Code: Select all

server {
    listen      192.168.0.21:80;
    server_name kkk.kk www.kkk.kk;
    root        /home/admin/web/kkk.kk/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/kkk.kk.log combined;
    access_log  /var/log/nginx/domains/kkk.kk.bytes bytes;
    error_log   /var/log/nginx/domains/kkk.kk.error.log error;

    location / {

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9001;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/kkk.kk/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

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


location @rewriteapp {
            rewrite ^(.*)$ /app.php/$1 last;
	}
    
    # Correctly pass scripts for installer
        location /install/ {
            # phpBB uses index.htm
            try_files $uri $uri/ @rewrite_installapp;

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include 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    127.0.0.1:9001; 
            }
	}
	
	location @rewrite_installapp {
            rewrite ^(.*)$ /install/app.php/$1 last;
	}

	

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.kkk.kk.conf*;
}

Re: Шаблон для phpBB

Posted: Thu Mar 04, 2021 4:13 pm
by trom
При таком конфиге получаю
500 Internal Server Error

да Vesta стоит на Сentos 7 на виртуалке в локальной сети

Code: Select all

server {
    listen      192.168.0.21:80;
    server_name kkk.kk www.kkk.kk;
    root        /home/admin/web/kkk.kk/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/kkk.kk.log combined;
    access_log  /var/log/nginx/domains/kkk.kk.bytes bytes;
    error_log   /var/log/nginx/domains/kkk.kk.error.log error;

    
    

        location / {
            # phpBB uses index.htm
            index index.php index.html index.htm;
            try_files $uri $uri/ @rewriteapp;
        }

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

        # Deny access to internal phpbb files.
        location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|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;
            return 404;
        }

        # Pass the php scripts to fastcgi server specified in upstream declaration.
        location ~ \.php(/|$) {
            # Unmodified fastcgi_params from nginx distribution.
            include 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/ /app.php$is_args$args;
            fastcgi_index   index.php;
            fastcgi_pass 127.0.0.1:9001; # - должно быть то же самое, что и в секции location / дефолтного шаблона
          }


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

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include 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 127.0.0.1:9001; # - должно быть то же самое, что и в секции location / дефолтного шаблона
            }
        }

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


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

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/kkk.kk/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    location /vstats/ {
        alias   /home/admin/web/kkk.kk/stats/;
#        include /home/admin/conf/web/kkk.kk.auth
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.kkk.kk.conf*;
}