我的服务器的适当 Nginx 配置有问题。
It 上部署的 php 应用程序是OJS,一个期刊管理和发布系统,最初开发用于在 Apache 1上运行。尽管 OJS 可以在没有进一步特定服务器配置的情况下在 Nginx 上运行,但必须对 OJS 主配置设置(disable_path_info ON)进行细微更改,因为 Nginx 似乎不支持 PATH_INFO。然而,这会生成非漂亮的 URL,这反过来会导致一些 OJS 功能/插件超出规范,或者根本无法工作2。
我发现一些帖子是人们分享这方面的成功经验:
- https://coolpandaca.wordpress.com/2012/12/07/migrate-ojs-to-nginx-from-apache
- https://forum.pkp.sfu.ca/t/ojs3-on-nginx-php7-0-fpm/28590
- 这是另一个网站
- https://www.snip2code.com/Snippet/305514/nginx-configuration-for-OJS-on-an-aegir-
我在 Laravel Forge 配置的 Digital Ocean 帐户上运行 Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic 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 Off 并能够在 Nginx 上运行时使用漂亮的 URL。
对此的任何帮助将不胜感激!