iTop和NGINX

转换Apache的配置

您将必须手动将iTop源代码中的.htaccess转换为Nginx的配置。

请注意,在每个升级之后,您应该检查是否引入了新规则。最简单的方法是使用github(例)

门户

如果您在NGINX上运行iTop并选择了增强门户,则很可能在某些门户页面上遇到404错误。

默认情况下,访问网址时: http://localhost/dir/script.php/arg1/arg2 NGINX认为script.php是目录,并尝试执行位于 /dir/script.php/arg1/arg2 (不存在)中的索引文件。

在iTop中,这意味着当NGINX试图执行时http地址:http://localhost/pages/exec.php/browse/faq?exec_module=itop-portal.php&exec_page=index.php NGINX实际上试图执行不是真正的脚本的 /pages/exec.php/browse/faq 。

您需要正确配置NGINX服务器,以便它可以正确地提供这些URL。

增强门户基于Symfony框架,该框架提供了documentation关于此配置。您可以使其适应您的实例。请记住,门户使用uses /pages/exec.php instead of /index.php.

我们的社区用户在其NGINX实例上使用了该配置,以使门户正常工作。由于尚未测试,因此无法确定其是否正常运行,但这可能会有帮助:

location / { try_files $uri $uri/ =404; } location ~ ^(.+.\.php)(/|$) { fastcgi_pass unix:/var/run/php7.2-fpm.sock; #For Debian, depends on distributive fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

原贴链接:https://www.itophub.io/wiki/page?id=2_7_0%3Ainstall%3Ainstalling_itop


iTop and NGINX

Convert Apache's configuration

You will have to manually convert the .htaccess present in the iTop source code to Nginx's configuration.

Please note that after each upgrade, you should check if new rules were introduced. The simplest way is to compare file changes using github (example)

Portal

If you are running iTop on NGINX and choosed the enhanced portal, you are most likely to encounter a 404 error on some portal pages.

By default when accessing an url like : http://localhost/dir/script.php/arg1/arg2 NGINX thinks that script.php is a directory and tries to execute the index file located at /dir/script.php/arg1/arg2 (which doesn't exists).

In iTop this means that when NGINX is trying to execute http://localhost/pages/exec.php/browse/faq?exec_module=itop-portal.php&exec_page=index.php NGINX actually tries to execute /pages/exec.php/browse/faq which is not a real script.

You need to configure your NGINX server properly so it can serve those urls correctly.

The enhanced portal is based on the Symfony framework which provides a documentation about this configuration. You can adapt it to your instance. Just keep in mind that the portal uses /pages/exec.php instead of /index.php.

One of our community user used this configuration on his NGINX instance to make the portal work. As we have NOT tested it, we can't say for sure that it is working but this could be of some help :

location / { try_files $uri $uri/ =404; } location ~ ^(.+.\.php)(/|$) { fastcgi_pass unix:/var/run/php7.2-fpm.sock; #For Debian, depends on distributive fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

标签:
由 superadmin 在 2020/08/27, 15:53 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司