如何运行Nginx的上开放期刊系统(OJS)

问题描述 投票:0回答:2

我有我的服务器的相应Nginx的配置麻烦。

在它的部署PHP应用程序是OJS,日志管理和发布系统,最初开发于上Apache1运行。虽然OJS可以在Nginx的运行没有更具体的服务器配置,在主OJS配置设置(disable_path_info ON)的微小变化必须做,因为PATH_INFO似乎没有nginx的支持。但是产生不漂亮的URL,而这又导致一些OJS功能/插件,制定出规范,或者根本不all2工作。

我发现一些帖子被分享的人对成功的经验:

我对Laravel锻造配置了数字海洋帐户运行Ubuntu 18.04.1 LTS(GNU / Linux的4.15.0-42泛型x86_64的)。

我无法找到这个代码块(那些在上面的链接的例子),与我的默认设置Nginx的结合的方式。

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/evidenciaonojs.tk/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name evidenciaonojs.tk;
    root /home/forge/evidenciaonojs.tk/;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    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 (DO NOT REMOVE!)
    include forge-conf/evidenciaonojs.tk/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/evidenciaonojs.tk-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

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

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/evidenciaonojs.tk/after/*;

我希望改回OJS配置文件中disable_path_info关,并能够对Nginx的运行时使用漂亮的URL。

任何帮助将真正的赞赏!

php nginx laravel-forge ojs
2个回答
0
投票

我刚才看到了OJS3论坛的消息。

对于nginx的尝​​试此配置

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/evidenciaonojs.tk/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name evidenciaonojs.tk;
    root /home/forge/evidenciaonojs.tk/;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    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 (DO NOT REMOVE!)
    include forge-conf/evidenciaonojs.tk/server/*;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    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/evidenciaonojs.tk-error.log error;

    error_page 404 /index.php;

    location ~ ^(.+\.php)(.*)$ {
        set $path_info $fastcgi_path_info;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param PATH_TRANSLATED $document_root$path_info;

        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        include fastcgi_params;

        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

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

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/evidenciaonojs.tk/after/*;

一定要设置: 1. cgi.fix_pathinfo=1在PHP-FPM(在/etc/php/7.2/fpm/php.ini可能)。 2.在你的FPM池的配置文件(在/etc/php/7.2/fpm/pool.d/your_site.conf)security.limit_extensions = .php 3. disable_path_info = Off(在OJS的config.inc.php)

重新启动PHP-FPM和Nginx的服务。然后,如果它的工作原理,了解nginx的IF和“cgi.fix_pathinfo”的弊端。


0
投票

只是CON确认的事情,在我的情况是有用的(由Laravel锻造配置了数字海洋帐户的Ubuntu 18.04.1 LTS)成功运行OJS对Nginx的包括:

1)修改cgi.fix_pathinfo = 1 PHP-FPM(在/etc/php/7.2/fpm/php.ini)

2)取消注释(启用)= security.limit_extensions .PHP(在/etc/php/7.2/fpm/pool.d/www.conf)

3)变更disable_path_info =关闭(在OJS config.inc.php中)。

4)更换用nginx的配置:

# FORGE CONFIG (DO NOT REMOVE!)
 include forge-conf/evidenciaonojs.tk/before/*;

 server {
     listen 80;
     listen [::]:80;
     server_name evidenciaonojs.tk;
     root /home/forge/evidenciaonojs.tk/;

 # FORGE SSL (DO NOT REMOVE!)
 # ssl_certificate;
 # ssl_certificate_key;

 ssl_protocols TLSv1.2;
 ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
 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 (DO NOT REMOVE!)
 include forge-conf/evidenciaonojs.tk/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/evidenciaonojs.tk-error.log error;

 error_page 404 /index.php;

 location ~ ^(.+\.php)(.*)$ {
     set $path_info $fastcgi_path_info;
     fastcgi_split_path_info ^(.+\.php)(.*)$;
     fastcgi_param   PATH_INFO               $path_info;
     fastcgi_param   PATH_TRANSLATED         $document_root$path_info;
     fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
     fastcgi_index index.php;
     include fastcgi_params;
 }

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

 # FORGE CONFIG (DO NOT REMOVE!)
 include forge-conf/evidenciaonojs.tk/after/*;

5)最后重新启动服务(服务php7.2-FPM重启和须藤服务nginx的重启)。

© www.soinside.com 2019 - 2024. All rights reserved.